Skip to content

Base64 Encoder & Decoder

Encode text to Base64 or decode it back, with correct UTF-8 and URL-safe base64url support. Runs entirely in your browser.

Runs entirely in your browser. Nothing you paste here is sent to us or anyone else โ€” there is no server processing, no logging of input, and no third-party scripts on this page.

Base64 is a way to represent any data as plain ASCII text, so it can travel safely through channels that only understand text. The tool above encodes text to Base64 or decodes Base64 back to text, handles UTF-8 correctly so emoji and accents survive intact, and offers a URL-safe variant. Everything runs in your browser, and nothing you paste is transmitted anywhere.

What is Base64?

Base64 is a binary-to-text encoding scheme. It takes arbitrary bytes and represents them using a fixed set of 64 printable characters: the letters A to Z and a to z, the digits 0 to 9, and two symbols. Every three bytes of input (24 bits) are split into four 6-bit groups, and each group maps to one of those 64 characters. When the input length is not a multiple of three, one or two = characters are appended as padding.

The point is safe transport, not compression or secrecy. Many systems, such as email headers, URLs, and JSON fields, expect text and can mangle raw binary. Base64 turns that binary into a string those systems will carry unchanged.

Standard Base64 vs Base64url

Standard Base64 uses + and / as its last two characters and pads with =. Those characters have special meanings in URLs and filenames, so a second variant called base64url exists. It swaps + for - and / for _, and it usually drops the = padding entirely. This makes the output safe to place directly in a query string, a path segment, or a filename without extra escaping. JSON Web Tokens, for example, use base64url for every segment.

Feature Standard Base64 Base64url
Character 62 + -
Character 63 / _
Padding = kept usually dropped
Safe in URLs No, needs escaping Yes

When you tick the URL-safe option above, encoding produces base64url. Decoding always accepts either form, so you never have to guess which variant you were given.

Why UTF-8 handling matters

Base64 works on bytes, but text is not bytes until you choose an encoding. A common bug is to encode text one character at a time and assume each character is a single byte. That breaks the moment you hit an emoji, an accented letter, or any non-Latin script, because those characters are several bytes in UTF-8. This tool converts your text to UTF-8 bytes first, then encodes those bytes, and reverses the process on decode. The result is that cafรฉ, โ‚ฌ, and ๐Ÿš€ all round-trip perfectly.

A worked example

Take the word Man. Its three bytes are 77, 97, 110. Written in binary that is 01001101 01100001 01101110. Regroup those 24 bits into four 6-bit chunks: 010011 010110 000101 101110, which are the numbers 19, 22, 5, and 46. Looking those up in the Base64 alphabet gives T, W, F, and u, so Man encodes to TWFu. Decode it here and you get Man back.

Common use cases

  • Embedding small images or fonts directly in HTML or CSS as data: URIs.
  • Reading or hand-checking the payload of a JSON Web Token, which stores base64url segments.
  • Encoding binary attachments for email, which uses Base64 inside MIME.
  • Passing structured or binary values through URL parameters using the URL-safe variant.
  • Storing small blobs of data in text-only config files or environment variables.

Base64 is not encryption

This is the single most important thing to understand: Base64 provides no security whatsoever. It has no key and no secret. Anyone who sees a Base64 string can decode it back to the original in an instant, exactly as this tool does. Encoding is about format and transport; encryption is about confidentiality. If you need to protect a secret, use real encryption such as AES, and never treat a Base64 string as if it were hidden. Developers sometimes see an unreadable token and assume it is protected, but if it is only Base64, it is effectively in plain sight.

Common errors when decoding

  • Invalid characters โ€” pasting surrounding quotes, prose, or a partial copy introduces characters outside the alphabet. The status line names the offending character.
  • Bad length โ€” a Base64 string that has been truncated cannot be decoded; valid input is a whole number of 4-character groups once padding is accounted for.
  • Missing padding โ€” this is fine here. The decoder re-adds any padding that a URL-safe encoder stripped, so both padded and unpadded input work.

Privacy

Every conversion above happens locally with your browser’s native encoder and decoder. There is no server round-trip, no logging, and no third-party analytics on this page, so you can safely work with data you would not want to send elsewhere. As always with any online tool, use your judgement for the most sensitive values; because this runs entirely client-side, you can also load the page and then disconnect from the network to be certain.

Frequently asked questions

Is my text sent to a server?

No. Encoding and decoding happen entirely in your browser using built-in functions. Nothing you type or paste is uploaded, logged, or stored, so you can even run it with your connection disabled once the page has loaded.

Does it handle emoji and accented characters correctly?

Yes. The tool encodes text as UTF-8 first (using TextEncoder), so multibyte characters like emoji, accented letters, and non-Latin scripts round-trip exactly. A naive encoder that ignores UTF-8 would corrupt these characters.

What is the difference between Base64 and Base64url?

They use the same idea but a slightly different alphabet. Standard Base64 uses "+" and "/" and pads with "=". Base64url replaces "+" with "-" and "/" with "_" and usually drops the padding, so the result is safe to drop into URLs and filenames without escaping.

Do I need to pick the right variant when decoding?

No. The decoder accepts both standard and URL-safe input automatically. It normalises the alphabet and re-adds any missing padding before decoding, so you can paste either form.

Is Base64 a form of encryption?

No. Base64 is encoding, not encryption. Anyone can decode it instantly with no key, as this tool shows. It provides zero confidentiality, so never rely on it to hide passwords, tokens, or other secrets.

Why did decoding fail with an error?

The input contained a character that is not part of the Base64 alphabet, or its length was invalid. Common causes are copying extra text, stray quotes, or a truncated string. Whitespace and line breaks are ignored automatically.

Why is the encoded output larger than the input?

Base64 represents every 3 bytes of data as 4 text characters, so the output is roughly 33 percent larger than the raw input. That is the cost of turning binary-safe data into plain ASCII text.

What is Base64 actually used for?

It lets binary or non-ASCII data travel safely through text-only channels: email attachments (MIME), data URIs in CSS and HTML, JSON Web Token segments, and embedding small images or fonts directly in source files.