Skip to content

Base64 Encoder and Decoder

Convert text to Base64 and back, including URL-safe output.

Runs entirely in your browser

Encoding and decoding happen in your browser, so nothing you paste is uploaded or stored.

Base64 exists to move bytes through places that only accept text, and the place it usually goes wrong is Unicode. The browser pair of btoa and atob refuses any character above the Latin-1 range, which is why accented text and emoji so often come back mangled. This converter turns your text into UTF-8 bytes before encoding, so Vietnamese, Japanese and emoji survive the round trip unchanged.

More about Base64 Encoder and Decoder

Both alphabets are here. The standard one uses plus and slash with padding on the end; the URL-safe variant swaps those for hyphen and underscore and drops the padding, which is the form JWT segments, query strings and file names need. The URL-safe switch applies in both directions, so a value produced on this page decodes on it too.

Decoding is strict on purpose. A character outside the alphabet is reported with its position instead of the opaque error the platform throws, a string whose length is not a multiple of four is named as incomplete, and bytes that are not valid UTF-8 are offered as a file download rather than rendered as mojibake. Paste something that already looks encoded into the encode side and the tool offers to switch, but it never switches on its own.

  • Encode and decode, with a Swap button that feeds the result back as input
  • Unicode-safe through UTF-8, so accents and emoji survive the round trip
  • URL-safe alphabet option using hyphen and underscore, with padding dropped
  • Invalid characters reported with their exact position in the string
  • Decoded binary offered as a file download instead of broken text
  • Pasted Base64 detected on the encode side, with a prompt to switch
  • Accepts input up to five megabytes
  • Copy the result or download it as a text file

How to use it

  1. 1Choose Encode or Decode, then paste your text or Base64 into the left panel.
  2. 2Turn on URL-safe when the value belongs in a URL, a file name or a JWT.
  3. 3Read the converted value in the right panel, which updates as you type.
  4. 4Use Swap to send the result back to the input and reverse the direction.
  5. 5Copy the output, or download it when the decoded bytes turn out to be binary.

Questions

Is my data uploaded?

No. Both directions run in your browser, and the text never leaves your device.

Why do my emoji break when I encode them elsewhere?

Most broken Base64 comes from encoding UTF-16 code units rather than UTF-8 bytes. This tool encodes UTF-8, so decoding with any UTF-8 decoder gives back exactly what you typed.

What is URL-safe Base64?

It replaces plus with hyphen and slash with underscore and removes the trailing padding, so the value survives a URL or a file name. JWT segments use this variant.

Why does it say my Base64 is invalid?

Either it contains a character outside the alphabet, in which case the message gives the position, or its length is not a multiple of four once padding is counted. A URL-safe value decoded in standard mode is the most common cause.

Can I decode something that is not text?

Yes, and when the decoded bytes are not valid UTF-8 the tool offers them as a download instead of showing them. The downloaded file keeps the bytes exactly as they decoded.

More Developer Tools
Esc

16 results