Skip to content

Developer Tools

Base64 Encode / Decode

Convert text to Base64 and decode Base64 back to text. Fully Unicode-safe, so emoji and non-Latin scripts work correctly. Runs entirely in your browser.

Developer Tools · Base64 Encode / DecodeRuns in your browser

How to encode or decode Base64

  1. Choose Encode or Decode with the two buttons at the top. The label above the box changes to say which kind of input it expects.
  2. Paste the text, or the Base64 string, into the box. A Base64 string may contain line breaks and spaces; they are skipped while decoding.
  3. Press Encode to Base64 or Decode from Base64. Nothing is converted until you press the button, so you can edit freely first.
  4. Use Copy to put the result on your clipboard. The button reads Copied! for a moment to confirm.

What happens to accented letters and emoji

Text is first turned into UTF-8 bytes with the browser's TextEncoder, and those bytes are what get Base64-encoded. Decoding reverses the two steps: the Base64 is unpacked to bytes, and the bytes are read back as UTF-8. That is why é becomes w6k= here, two bytes C3 A9, rather than the 6Q== that an older Latin-1 encoder would produce. If you paste 6Q== into the decoder, the single byte E9 is not valid UTF-8 and comes back as the replacement character, a question mark in a diamond.

The same rule covers emoji: a grinning face is four bytes in UTF-8 and encodes to 8J+YgA==, and Zürich, seven bytes because of the ü, becomes WsO8cmljaA==. The sample text Hello, All Day Toolkit! is 23 bytes and produces the 32-character string SGVsbG8sIEFsbCBEYXkgVG9vbGtpdCE=.

Why the output length is always a multiple of four

Base64 packs every three bytes (24 bits) into four characters of six bits each. When the byte count is not a multiple of three, the last group is filled out with one or two equals signs. The encoded length is therefore 4 × ceil(bytes ÷ 3): 23 bytes give 32 characters, and the result is roughly a third larger than the input.

InputBytesBase64Padding
a1YQ==two equals signs
ab2YWI=one equals sign
abc3YWJjnone
Man3TWFunone
user:pass9dXNlcjpwYXNznone

What the decoder accepts and what it rejects

Pasted inputResult
Standard Base64 with padding (SGVsbG8=)Decoded
Padding left off (SGVsbG8)Decoded; the browser tolerates missing padding
Line breaks every 76 characters, as in email bodiesDecoded; whitespace is ignored
Extra equals signs (SGVsbG8==)Error: That isn't valid Base64.
URL-safe alphabet containing - or _Error; swap - for + and _ for / first, or use the JWT Decoder for tokens
A data: URL such as data:image/png;base64,iVBOR…Error; remove everything up to and including the comma
Valid Base64 of a binary fileGarbled text with replacement characters, because the bytes are shown as UTF-8

Standard versus URL-safe Base64

RFC 4648 defines two alphabets. The standard one in section 4 uses A to Z, a to z, 0 to 9, plus and slash, with equals for padding; that is the only alphabet this tool reads and writes. The base64url variant in section 5 replaces plus with minus and slash with underscore and usually drops the padding, which is what JWTs and many API keys use. To place standard Base64 inside a URL, run the result through the URL Encode tool so plus becomes %2B, slash becomes %2F and equals becomes %3D.

Places you will run into Base64

  • HTTP Basic authentication: the Authorization header carries user:pass encoded as dXNlcjpwYXNz, which is why it is not a form of encryption.
  • Data URLs that embed small images or fonts directly in CSS and HTML.
  • Email attachments, where MIME wraps the encoded body at 76 characters per line.
  • Kubernetes Secrets and many configuration files, where values are stored encoded rather than encrypted.
  • The header and payload of a JWT, in the URL-safe variant described above.

Limits worth knowing

This is a text tool: there is no file picker, so you cannot drop an image in and get a data URL out. Decoded output is always interpreted as UTF-8 text, so binary content cannot be downloaded as a file. Large strings are fine, but the whole result is built in memory and shown in a text box, so pasting tens of megabytes will make the page sluggish.

Frequently asked questions

Does it support emoji and non-English text?

Yes. The tool encodes and decodes using UTF-8, so emoji, Arabic, Chinese and other non-Latin characters convert correctly without corruption.

What is Base64 used for?

Base64 represents binary or text data using a safe set of ASCII characters. It's commonly used to embed images in CSS or HTML, send data in URLs, and store credentials in config files.

Why does decoding give me question marks or odd symbols?

The decoded bytes are being read as UTF-8 text. If the original was a binary file, or text encoded with Latin-1 or Windows-1252, the bytes do not form valid UTF-8 and are shown as replacement characters.

Can I decode a Base64 string that is split across several lines?

Yes. Line breaks and spaces inside the string are ignored while decoding, so text copied from an email source or a wrapped config file works as it is.

Does it handle the URL-safe variant with minus and underscore?

No. Only the standard alphabet is accepted, so those characters trigger the invalid Base64 error. Replace minus with plus and underscore with slash before decoding.

Can I encode a file or a picture?

Not here. The tool only works on text you paste. To embed an image you need an encoder that reads the file bytes directly.

Explore

113 tools. Zero uploads. One place.

Every tool opens instantly, works on your phone and keeps your files on your device.

Base64 Encode / Decode guides