Base64 encode and decode

Turn text into Base64, or Base64 back into readable text.

This free Base64 encoder and decoder works in your browser. There is no fixed size limit, because everything runs on your device. It works in current browsers on phones, tablets and computers. Encoding and decoding are exact, so nothing is lost and the quality of the data is unchanged. Everything runs in your browser. What you type is not sent anywhere. All inputs and calculations run locally on your device without server uploads; details on browser processing and storage are set out in the privacy policy.

How Base64 works

Base64 represents any data using 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, so encoded data is about 33% larger. An = or == at the end pads the last group. It exists so that binary data can travel through systems built for text, such as email, JSON and URLs.

TextBase64
HelloSGVsbG8=
Hi!SGkh
नमस्ते4KSo4KSu4KS44KWN4KSk4KWH

Good to know

  • Spaces and line breaks in Base64 input are ignored when decoding, so wrapped Base64 from emails works.
  • Missing = padding is added back automatically.
  • To turn an image into a Base64 data URL, use an image-to-Base64 tool; this page is for text.

Worked example: Encoding UTF-8 text with accents and Indic script to Base64 and Base64URL

Suppose you need to encode the string Café ₹500? into both Standard Base64 (RFC 4648 §4) and URL-safe Base64URL (RFC 4648 §5):

  • Step 1 — UTF-8 byte sequence (12 bytes): In UTF-8, C (0x43), a (0x61), f (0x66) take 1 byte each; é takes 2 bytes (0xC3 0xA9); space is 0x20; the Indian rupee sign ₹ takes 3 bytes (0xE2 0x82 0xB9); and 500? takes 4 bytes (0x35 0x30 0x30 0x3F) = 12 bytes (96 bits).
  • Step 2 — Group into 6-bit chunks: Because 96 bits divides evenly by 6 into 16 sextets (and 12 bytes is a multiple of 3), no = padding is needed at the end.
  • Standard Base64 output: Q2Fmw6kg4oK5NTAwPw== (if 11 bytes without ?: Q2Fmw6kg4oK5NTAw; with ? the last sextets produce / or + in certain byte combinations, which Base64URL swaps to _ and - while stripping trailing =).

Limits and what this tool cannot do

  • Base64 is not encryption or security: Base64 is a public binary-to-text alphabet with zero secret key. Anyone can decode a Base64 string in one click; never store plaintext passwords or API keys in Base64 thinking they are hidden.
  • Text input vs raw binary files: This page encodes and decodes UTF-8 text strings. If you paste raw binary file bytes or want to preview a decoded PNG/JPEG image, use Base64 to Image instead.
  • 33% size overhead: Every 3 bytes of input become 4 ASCII characters (plus = padding), increasing payload size by roughly 33.3%.

Questions

Is Base64 secure?

No. It is an encoding, not encryption. Anyone can decode it.

Why is my decoded text garbled?

The data was probably not text to begin with, such as an image or a zip file, or it used a different character set than UTF-8.

Is my text uploaded?

No. Everything runs in your browser. What you type is not sent anywhere.

Why does JavaScript's built-in btoa() fail on emojis and non-English letters?

The browser's legacy window.btoa() function only accepts Latin-1 (ISO-8859-1) characters with code points 0–255 and throws an InvalidCharacterError on multi-byte Unicode. This tool encodes strings to UTF-8 bytes via TextEncoder first so any script or emoji works properly.

When should I choose Base64URL instead of Standard Base64?

Use Base64URL whenever the encoded string goes inside a URL query parameter, filename, or JSON Web Token (JWT), because standard Base64's +, /, and = characters have special reserved meanings in URLs.

Why do some Base64 strings end with = or ==?

Base64 processes input in 3-byte (24-bit) groups. If the input length leaves 1 byte left over at the end, two == signs pad the final 4-character block; if 2 bytes are left over, one = sign pads the block.

Last reviewed .

Related converters and guides