Base64 Encode and Decode Text

Type text to base64 encode it, or paste Base64 to decode it. This base64 encoder updates as you type.

Runs in your browser. Nothing you enter is uploaded.

Text → Base64

standard: +/ alphabet, = padding

Base64 → Text

decoded as UTF-8

How to use the Base64 encoder & decoder

  1. Enter text in the Text box to base64 encode it.
  2. Check the URL-safe (-_, no padding) checkbox if you need that alphabet.
  3. Copy the encoded result from the Base64 box with the Copy button.
  4. Paste Base64 in the Base64 box on the right to decode it.
  5. If the Base64 input is invalid, an error appears below the Base64 box on the right.

What does base64 encode change?

Base64 encode changes text into a string using the UTF-8 bytes of the original text. Standard output uses the alphabet A-Z, a-z, 0-9, +, and /, with = padding when the byte length is not a multiple of 3. For example, the text Hello, world becomes SGVsbG8sIHdvcmxk. The URL-safe variant uses - and _ instead of + and / and omits = padding.

How does base64 decode handle input?

The decode side reads Base64 from the Base64 box and returns UTF-8 text. It accepts standard and URL-safe input. It ignores spaces and line breaks, and it can accept missing = padding. For example, 4pyTIMOgIGxhIG1vZGU decodes to ✓ à la mode without the final =. Invalid characters or an invalid length produce an error message.

When should you use URL-safe Base64?

Use URL-safe Base64 when the result will appear in a URL, fragment, or query string. It replaces + with - and / with _. It also omits = padding. For example, the text ??>> encodes to Pz8+Pg== in standard mode and to Pz8-Pg in URL-safe mode. Decoding accepts both forms, so Pz8-Pg returns ??>>.

Frequently asked questions

What is base64 encode used for?

Base64 encode is used to represent text or binary data as ASCII characters. It is common in email attachments, data URLs, and encoding small values in URLs. It is not encryption. For example, Hello, world becomes SGVsbG8sIHdvcmxk, which can be stored or transmitted as plain text.

Does base64 encode make data secure?

No. Base64 encode is not encryption. It only changes the representation of data. Anyone can decode it back to the original text. For example, SGVsbG8sIHdvcmxk decodes to Hello, world. Use encryption if the data must be kept private.

What is the difference between standard and URL-safe Base64?

Standard Base64 uses + and / and may add = padding. URL-safe Base64 uses - and _ and omits padding. For example, ??>> becomes Pz8+Pg== in standard mode and Pz8-Pg in URL-safe mode. The decode side accepts both forms.

Does this base64 online tool upload my text?

No. The page does not send the text or Base64 to a server. It only changes the data shown in the page. The result appears in the page.

Why is my Base64 decode failing?

Base64 decode fails when the input contains characters outside the Base64 alphabet or when the length is not valid. Whitespace and line breaks are ignored, and missing padding is accepted. For example, abc$ is invalid because $ is not a Base64 character.

Related tools