Free online tools
English EN, Choose a language

Base64 encode and decode

Decode Base64 to text or encode text to Base64 as you type. UTF-8 safe, with URL-safe and unpadded options.

Direction

Result

Type or paste text and the Base64 result appears here.

Runs in your browser. Your text is never uploaded or stored.

How to decode and encode Base64

  1. Choose Encode to Base64 to turn text into Base64, or Decode from Base64 for the other way. The result updates as you type.
  2. When encoding, tick URL-safe for tokens and URLs, Remove = padding if the receiver wants none, or Wrap at 76 for email (MIME) style lines.
  3. Copy the result or download it. Use as input moves it back into the box so you can chain an encode and a decode to check a round trip.

Examples: Hello encodes to SGVsbG8=, and decoding SGVsbG8= gives back Hello.

What Base64 is

Base64 represents binary data using 64 printable characters: A-Z, a-z, 0-9, + and /. Every 3 bytes become 4 characters, so the output is about 33% larger than the input, and a trailing = or == pads the last group. It exists so that data can travel through systems built for text: email attachments, data URLs, JSON fields, HTTP headers such as Basic authentication.

Base64 is not encryption. Anyone can decode it, so never use it to hide a password. It is an encoding, like writing a number in hexadecimal. The specification is RFC 4648.

Padding, in three examples

The padding comes from how many bytes are left in the final group of three:

TextBytesBase64
a1YQ==
ab2YWI=
abc3YWJj
Hello, World!13SGVsbG8sIFdvcmxkIQ==

One leftover byte gives ==, two give =, none give no padding. Many systems drop the padding (JWT, URLs) because the length already tells you how much is missing. This decoder accepts text with or without it: SGVsbG8 decodes to Hello.

URL-safe Base64 and Unicode

The standard alphabet uses + and /, which have a meaning in URLs. The URL-safe variant replaces them with - and _. The same bytes Hi?>> give SGk/Pj4= in the standard alphabet and SGk_Pj4 in the URL-safe one without padding. The decoder understands both, so you can paste either.

Text is converted to UTF-8 bytes first, so Café ☕ encodes to Q2Fmw6kg4piV and decodes back unchanged. Older online tools that use JavaScript's btoa directly fail on any character outside Latin-1 or mangle it; this one does not. If you decode Base64 that was made from a file (an image, a PDF), the bytes are not text and the tool says so.

When Base64 text will not decode

The decoder tells you why. Decoding SGVsbG8* gives: Not valid Base64: the character "*" at position 8 is not in the Base64 alphabet.

Whitespace and line breaks are ignored when decoding. To read the three parts of a JSON Web Token use the JWT decoder; for percent-encoding in URLs use URL encode and decode.

Related tools

Base64 encode and decode FAQ

How do I decode Base64 online?

Choose Decode from Base64 and paste the text. The decoded text appears at once; whitespace, URL-safe characters and missing padding are all accepted.

How do I encode text to Base64?

Keep Encode to Base64 selected and type or paste your text. The text is converted to UTF-8 first, so accents and emoji work.

Is Base64 encryption?

No. It is a reversible encoding that anyone can decode. Do not use it to protect passwords or secrets.

What does the = at the end mean?

It is padding that fills the last group of 4 characters. One = means 2 bytes were left in the last group, two = means 1 byte. Some systems omit it.

What is URL-safe Base64?

A variant that uses - and _ instead of + and /, so the text can sit in a URL or file name without escaping. JWTs use it.

Why does my decoded text look like random symbols?

The data is probably binary (a file or compressed data) or text in a different encoding. The tool shows a note when the bytes are not valid UTF-8.

Is my text sent to a server?

No. Everything happens in your browser and nothing is uploaded or stored.

Missing something in the base64 encode and decode?Suggest an idea. It takes 20 seconds and we read every one.Suggest an idea

Sends only what you type here, never the text you work with. Your email is used only to reply about this idea.

Free online tools