glunty

Base64 Encoder & Decoder

Convert between text and base64. Standard or URL-safe. Pure client-side.

What this tool does

Base64 encoding represents arbitrary bytes using only 64 printable ASCII characters (A-Z, a-z, 0-9, plus + and /, with = for padding). It is the standard way to embed binary data in text-only formats: email attachments, JSON payloads, data URLs, JWT segments. This tool encodes any UTF-8 text to base64, and decodes base64 back to readable text. The URL-safe variant uses - and _ in place of + and / and drops padding, which is what JWT and many API designs use. Everything happens in your browser. Your input is not uploaded.

How to use it

Paste text into the input box. Press Encode to convert to base64, or Decode to convert base64 back to text. Toggle URL-safe variant if you need the JWT-style alphabet. Example: encoding the text hello, world! produces aGVsbG8sIHdvcmxkIQ== in standard form, or aGVsbG8sIHdvcmxkIQ URL-safe (no padding).

Common use cases

  • Building a data URL for an inline image or font in HTML or CSS.
  • Decoding the header or payload segment of a JWT (also see the JWT decoder for a fuller breakdown).
  • Embedding a small binary blob in a JSON document or a config file.
  • Reading the contents of a base64-wrapped value from an API response.
  • Converting between standard and URL-safe variants when integrating with two systems that disagree.

Common pitfalls

  • Padding. Standard base64 pads to a multiple of 4 with one or two equals signs. URL-safe base64 typically drops the padding. Mixing the two ("decode this URL-safe blob in standard mode") fails. Match the variant.
  • Encoding assumption. This tool encodes input as UTF-8 bytes. If your source data is already raw bytes (a hex string, a file's binary content), you cannot just paste it as text and expect a clean roundtrip. Convert to bytes first.
  • Whitespace and newlines. Some base64 producers wrap output at 76 characters per line (the email convention). Most decoders tolerate the embedded newlines, but a strict decoder may reject them. Strip whitespace first if a decode fails.

Frequently asked questions

What is base64 used for?
Base64 represents arbitrary binary data using only printable ASCII characters. Common uses include: embedding small images in HTML or CSS via data URLs, transporting binary attachments through text-only channels like email, encoding the segments of a JWT, and storing binary blobs in JSON or environment-variable values where raw binary would not survive.
What is the difference between standard base64 and URL-safe base64?
Standard base64 uses + and / as the last two characters of its 64-character alphabet, plus = for padding. URL-safe base64 substitutes - for + and _ for /, and typically drops the padding. URL-safe is what JWT, modern OAuth flows, and most web APIs use; standard is what email and older protocols use.
Why does base64 add padding (= signs) at the end?
Base64 encodes 3 bytes of binary as 4 characters. When the input length is not a multiple of 3, the encoder adds 1 or 2 padding characters (= or ==) to fill out the final group. URL-safe base64 typically omits padding because it can be inferred from the length.
Is base64 encryption?
No. Base64 is encoding, not encryption. Anyone can decode any base64 string trivially. Do not use base64 to hide passwords, secrets, or anything sensitive. For real privacy use proper encryption (AES-GCM via WebCrypto, libsodium, or similar).
How much larger is the base64 output than the original?
Base64 output is roughly 4/3 the size of the input (about 33 percent larger), plus a small fixed overhead for padding. A 100 KB binary becomes about 137 KB base64-encoded. This overhead is the cost of staying within printable ASCII.
Why does my decode fail with an invalid-character error?
The most common cause is mixing standard and URL-safe variants: trying to decode URL-safe base64 in standard mode (or vice versa). Toggle the URL-safe checkbox to match your input. Other causes are stray whitespace inside the encoded string (some decoders are strict) or characters that are not in either alphabet at all.

Embed this tool

Free for any use; attribution appreciated. Paste this on your site:

The embed runs the same tool that lives at this URL. No tracking; no ads inside the embed. Resize height as needed for your layout.

Cite this tool

For academic, journalistic, or technical references. Pick a format:

Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.

Embedded tool from glunty.com