Base64 encoder / decoder

Encode text to Base64 or decode Base64 back to plain text. Runs entirely in your browser.

What Base64 actually does

Base64 rewrites arbitrary binary data using only 64 characters that survive text handling everywhere: A–Z, a–z, 0–9, plus + and /. It takes three bytes at a time — 24 bits — and re-slices them into four 6-bit groups, each becoming one character. When the input does not divide evenly by three, the remainder is padded and marked with one or two = characters at the end.

Because four characters carry three bytes, Base64 output is always about 33 percent larger than the input. That overhead is the price of passing binary data through channels that only reliably carry text.

Where you will run into it

ContextHow Base64 is used
HTTP Basic AuthThe Authorization header carries base64(username:password). This is encoding only — over plain HTTP it is trivially readable.
Data URIsSmall images and fonts embedded directly in HTML or CSS as data:image/png;base64,… — saves a request but inflates the file.
JSON Web TokensAll three JWT segments are Base64URL. The header and payload are readable by anyone; only the signature is protected.
Email attachmentsMIME has encoded attachments this way since the early 1990s, because SMTP was designed for 7-bit text.
API payloadsBinary fields such as file uploads or certificates inside JSON, which has no native binary type.
PEM certificatesThe block between BEGIN and END CERTIFICATE is Base64-encoded DER.

Standard Base64 and the URL-safe variant

The two characters + and / are hostile to URLs and filenames, so RFC 4648 defines a second alphabet that swaps them out. If a decode fails on a token pulled from a URL, a variant mismatch is the usual cause.
StandardBase64URL
Character 62+-
Character 63/_
Padding= requiredusually omitted
Used byMIME, PEM, Basic AuthJWTs, URL parameters, filenames
Converting between them is a straight character substitution — replace - with + and _ with /, then re-add padding until the length is a multiple of four.

Base64 is not encryption

This is the single most consequential misunderstanding about Base64. It is an encoding, not a cipher. There is no key and no secret — anyone who sees the string can decode it in one step, exactly as this page does. Base64 offers no confidentiality whatsoever.

So never treat Base64 as a way to hide a password, an API key, or personal data. Encoded credentials sitting in a config file, a URL, or a log line are effectively in plain text. Use real encryption for secrecy, and TLS for anything crossing a network.

Unicode and this tool

Base64 encodes bytes, not characters, so any text has to become bytes first. This tool encodes as UTF-8, which is what browsers, APIs and modern systems expect. It is worth knowing because the raw JavaScript btoa() function does not do this — it throws on any character above U+00FF, which is why pasting an emoji or an accented name into a naive encoder produces an error rather than output.

Frequently asked questions

Is Base64 encryption?

No. It is a reversible encoding with no key. Anyone can decode it instantly, so it provides no security and must never be used to protect passwords, keys or personal data.

Why does my encoded text end in one or two equals signs?

That is padding. Base64 works on three-byte groups, so when the input length is not a multiple of three the final group is padded — one = for a two-byte remainder, two = for a one-byte remainder.

Why does my Base64 string fail to decode?

Most often it is the URL-safe variant, which uses - and _ in place of + and /. Whitespace or line breaks introduced by copying can also break it, as can missing padding.

Does Base64 make files smaller?

No — it makes them about 33 percent larger. It exists to make binary data safe to transport as text, never to compress it.

Can I encode emoji and accented characters?

Yes. Text is converted to UTF-8 bytes before encoding, so any Unicode character works — including emoji, which plain btoa() cannot handle.

Is my input sent to a server?

No. Encoding and decoding run entirely in your browser, so it is safe to use with tokens, certificates and private data.

Should I embed images as Base64 data URIs?

Only for very small assets such as icons. The 33 percent size increase is not cacheable separately from the page, so for anything sizeable a normal image request is faster.

Related free tools

JSON formatterJSON to CSVPassword generatorTimestamp converter