Base64 Encoder/Decoder

Encode and decode text using Base64 encoding

By

Developer tools

Runs in your browser. No signup required.

UTF-8 text through btoa

Encode turns the text into UTF-8 percent-encoding, unescapes those bytes, and passes them to btoa. That is how characters outside Latin-1 survive. Decode reverses the steps with atob and decodeURIComponent. A successful run replaces the output and clears the error. An exception on encode says to check the input. An exception on decode says the Base64 could not be read.

The box is text. It is not a file uploader. A PDF or a PNG dropped in as text will not round-trip as a file. Binary work belongs in a tool that reads bytes. Whitespace and missing padding in the decode box are a common reason atob throws. Paste the whole token, including trailing equals signs.

A data URL or a JWT segment

People paste a snippet they need to carry through a system that only allows ASCII, or they decode one segment of a token to see the JSON. Decoding a JWT segment is easier on the JWT page, which splits on the dots and formats the JSON. Use Base64 when you have a single blob that is not a three-part token.

The output is not encrypted. Anyone who sees the Base64 can decode it. Do not use it as a password or as a way to hide a secret in a URL. The URL shortener uses the same family of encoding for its hash and has the same limit: it is reversible on sight.

Empty input and Unicode

An empty or whitespace-only box stops with “Please enter some text to process.” and does not call btoa. Clear wipes input, output, and the error together. Emoji and non-English text depend on the UTF-8 path. If you decode a string that was encoded by a Latin-1-only tool, the characters can come back wrong. Match the encoder that created the payload.

Line breaks inside the input are part of the data. A certificate or a MIME body with headers is not peeled apart. Copy takes the output only. The hash generator is the neighbor when you need a digest you cannot reverse, which Base64 is not.

UTF-8 bytes, then the alphabet

Encode turns the text into UTF-8 bytes and then into the standard base64 alphabet. hello becomes aGVsbG8=. Hi! becomes SGkh. café becomes Y2Fmw6k= because the é is the two UTF-8 bytes C3 A9, not a single Latin-1 byte. Decode reverses that path. A string that is not valid base64, or that does not decode to UTF-8, clears the output and shows an error.

Switching between encode and decode clears the output. The input stays until you edit it or press clear. Empty input is refused with a message that asks for text. The page does not wrap lines at 76 characters and it does not use the URL-safe alphabet that swaps + and / for - and _.

What the encoding is for

Use it when a text field has to carry bytes, such as a small fixture or a data URL’s payload. It is not encryption. Anyone can decode aGVsbG8= back to hello. Do not put a password or a private key in the box and then share the result.

The JWT decoder uses base64url on the header and payload segments, and it also parses them as JSON. Pasting a JWT here will not split the three segments or check the signature. The HTML encoder escapes < and &, which is a different job from base64.

The text never leaves the tab

Both directions run in the browser. Nothing is uploaded and nothing is saved. Copy the output if you need it, then clear both boxes on a shared computer. A refresh drops the text.

Binary files are not accepted as files. If you paste a huge string, the tab has to hold both copies. This page does not compress the result. The hash generator is the page that digests text into a fixed hex string instead of an encoding you can reverse.

A round trip you can check

hi there encodes to aGkgdGhlcmU=. Decoding that string returns hi there, including the space. hello encodes to aGVsbG8= and decodes back to hello. The alphabet is A to Z, a to z, 0 to 9, plus, and slash, with equals signs as padding when the byte length is not a multiple of three. hello is five bytes, so the result ends with one equals sign. hi there is eight bytes, so it needs no padding.

A line break you type is part of the input. Encoding hello and then a newline is not aGVsbG8=. Decode will not ignore spaces you paste into the middle of a code. If a mail client wrapped the string, remove those breaks before you decode. The page does not add a line wrap of its own. Padding belongs at the end. A missing equals sign on hello’s code makes the decode fail rather than guessing the last byte.

How to use Base64 Encoder/Decoder

  1. 1

    Pick Encode or Decode with the two buttons above the text box.

  2. 2

    Paste your text, or the Base64 string, into the box labeled "Text to encode" or "Base64 to decode".

  3. 3

    Press Encode or Decode. If the input is not valid Base64, an error message appears instead.

  4. 4

    Use Copy result under the output box, or Clear to start over.

FAQ

Is Base64 encryption?

No. It is a reversible encoding. Anyone can decode it. Do not use it to hide secrets.

Can I encode text that is not ASCII?

Yes. Text is encoded as UTF-8 before Base64 is applied, and decode reverses that. This box is for text, not for uploading files.

Why did decode fail?

The input is not valid Base64, or it does not decode back into text. Remove line breaks that are not part of the data and try again.

Is the text uploaded?

No. Encode and decode run in the browser.

When is Base64 actually useful?

When a text-only field has to carry bytes, such as a data URL or a token segment. It makes data larger, not secret.

Can I encode a file?

No. The box is text. Binary files need a byte-oriented encoder. Pasting a file as text will not round-trip as that file.

Is Base64 a form of encryption?

No. Anyone can decode it. Do not use the output to hide a password or a token.

What is the encoding of hello?

aGVsbG8=. Hi! is SGkh. café is Y2Fmw6k= because é is two UTF-8 bytes.