Skip to main content

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 strings back to plain text instantly in your browser.

How to use

Paste your text in the input area and click Encode to convert it to Base64, or paste a Base64 string and click Decode to retrieve the original text. Use Clear to reset the fields, and Copy to copy the result to your clipboard.

What is Base64?

Base64 is a way to write any data, including binary data, using only 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding at the end. It is used wherever a channel only accepts plain text: e-mail attachments (MIME), data: URLs in HTML and CSS, HTTP Basic authentication headers, JSON payloads that carry files, and the parts of a JSON Web Token.

Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide a password or a secret.

How it works

The encoder takes the input three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit value (0–63) maps to one character of the Base64 alphabet. When the input length is not a multiple of three, the last group is padded with =. That is why Base64 output is always about a third longer than the input.

This tool first turns your text into UTF-8 bytes, so accents, Cyrillic, Japanese, Hindi and emoji all encode correctly. Decoding reverses the steps and reads the bytes back as UTF-8 text.

It runs in your browser: what you paste is never uploaded or stored.

Examples

Text Base64
Hello SGVsbG8=
Hello, world! SGVsbG8sIHdvcmxkIQ==
café Y2Fmw6k=
user:pass dXNlcjpwYXNz

The last one is what an HTTP header Authorization: Basic dXNlcjpwYXNz carries, which shows why Basic authentication must only be used over HTTPS.

Limitations

  • Input and output are text. To encode an image or another binary file, use a tool that reads files; pasting binary data as text corrupts it.
  • Decoding expects standard Base64. URL-safe Base64 (with - and _ instead of + and /, as in JWTs) must have those two characters swapped back first.
  • If the decoded bytes are not valid UTF-8 text (for example a compressed file), the result will look garbled.

Frequently asked questions

Is Base64 encryption?

No. Base64 only changes how data is written so it can travel through text-only channels. Anyone can decode it in a second, so it gives no protection to passwords or secrets.

Why does my Base64 string end with = or ==?

Base64 works on blocks of three bytes. When the input does not fill the last block, one or two = characters pad the output to a multiple of four characters. One = means the last block had two bytes, == means it had one.

Why is Base64 output longer than the input?

Every three bytes of input become four characters of output, so encoded data is about 33% larger, plus a little padding. That overhead is the price of using only safe text characters.

Can I decode URL-safe Base64 or a JWT segment here?

Replace every - with + and every _ with /, and add = until the length is a multiple of four; then it decodes normally. For tokens, the JWT Debugger on this site decodes the header and payload directly.

Does this tool handle emoji and non-Latin text?

Yes. Text is encoded as UTF-8 before it is turned into Base64, so emoji, accented letters and scripts like Cyrillic, Devanagari or Japanese round-trip without loss.

Is my data sent to a server?

No. Encoding and decoding run in JavaScript in your browser. Nothing you type is uploaded, logged or stored.