ToolNest

Base64 Encode / Decode

Free Base64 encoder and decoder with full Unicode support. Convert text to Base64 and back instantly in your browser.

Base64 converts binary data into 64 plain ASCII characters so it can travel through systems that only handle text — email bodies, JSON fields, URLs, HTML attributes and HTTP headers. It is a transport encoding, not compression and emphatically not encryption.

This tool encodes and decodes Base64 with full Unicode support, so emoji and non-Latin scripts round-trip correctly. Everything runs in your browser.

How to use the Base64 Encode / Decode

  1. Paste your text or Base64 string

    Plain text to encode, or an existing Base64 string to decode.

  2. Choose the direction

    Encode converts text to Base64; decode converts it back.

  3. Copy the result

    One click copies the output.

How Base64 works

Base64 takes three bytes — 24 bits — and re-splits them into four six-bit groups, each mapped to one of 64 characters: A–Z, a–z, 0–9, + and /. Because four characters now carry what three bytes did, the output is always about 33% larger than the input.

When the input length is not a multiple of three, = characters pad the end. This is why Base64 strings so often finish with one or two equals signs.

Base64 is not encryption

This is the most important thing to understand about it. Base64 is a fully reversible, public transformation with no key. Anyone can decode it instantly — including this page.

Never use it to protect passwords, API keys or personal data. HTTP Basic Authentication sends credentials as Base64, which is precisely why it is unsafe without TLS: anyone who can see the traffic can read the password directly.

If you need secrecy, use encryption. If you need integrity, use a hash. Base64 provides neither.

Where it is genuinely used

  • Email attachments — MIME encodes binary files as Base64 because SMTP was designed for 7-bit text.
  • Data URIs — data:image/png;base64,… embeds a small image directly in HTML or CSS, saving an HTTP request.
  • JSON payloads — JSON has no binary type, so files inside JSON are Base64 strings.
  • JWT tokens — the header and payload are Base64URL-encoded, which is why you can read a JWT’s contents without any key.
  • HTTP Basic Auth — username:password encoded as Base64 in the Authorization header.
  • Cryptographic keys and certificates — PEM files are Base64 wrapped in BEGIN/END lines.

Base64 and Base64URL

Standard Base64 uses + and /, both of which have special meaning in URLs and must be percent-encoded. Base64URL substitutes - and _ and usually drops the = padding, producing a string safe to place in a URL path or query without escaping.

JWTs use Base64URL. If a decoder rejects a token segment, this is usually why — translate - back to + and _ back to / before decoding with a standard implementation.

Unicode handling

The browser’s built-in btoa() function throws an error on any character above U+00FF, which means it fails on emoji, Chinese, Arabic, Tamil and most of the world’s text.

This tool encodes to UTF-8 bytes first, so any Unicode string round-trips correctly. If you are implementing this yourself, TextEncoder and TextDecoder are the modern way to do it.

Frequently asked questions

Is Base64 encryption?

No. It is a reversible public encoding with no key — anyone can decode it instantly. Never use it to protect passwords, keys or personal data.

Why do Base64 strings end with equals signs?

They are padding. Base64 processes three bytes at a time; when the input length is not a multiple of three, one or two = characters pad the final group.

Does Base64 make files smaller?

The opposite — output is about 33% larger than the input, because four characters are used to represent every three bytes.

Can it handle emoji and non-English text?

Yes. This tool encodes to UTF-8 first, so emoji, Chinese, Arabic, Tamil and any other script round-trip correctly, unlike the browser’s raw btoa().

What is Base64URL?

A variant using - and _ instead of + and /, with padding usually omitted, so the result is safe in URLs without escaping. JWTs use it.

Why is my Base64 failing to decode?

Usually the string is Base64URL rather than standard, has been truncated, or contains inserted line breaks. Translate - to + and _ to /, and remove whitespace.

Is my data sent anywhere?

No. Encoding and decoding happen entirely in your browser, so it is safe for tokens and internal data.

Can I Base64 encode an image?

Yes, though this tool handles text. Image encoding is typically done to build a data URI, which is only worthwhile for small assets — the 33% size increase outweighs the saved request beyond a few kilobytes.

100% private. Files are processed on your device and never uploaded.

Instant results. No upload queue. Processing time depends on your device.

Free forever. No signup, no watermark, no paid tier.

Works everywhere. Use a modern browser on your phone or computer.

Related tools

Base64 Encode / Decode is one of all the free tools on ToolNest. No account or subscription needed — anywhere in the world.