Skip to content
DevTools

Base64

text ⇄ base64

Encode and decode Base64, including files to data URIs.

Text is read as UTF-8 before encoding.
plain text
0 B
base64
Encoded output appears here
file to data uriThe file is read locally — it is never uploaded.

About Base64

Base64 rewrites arbitrary bytes using 64 printable characters, so binary data can travel through channels that only reliably carry text — HTTP headers, JSON string fields, email bodies, environment variables. Encoding and decoding both happen as you type, in either direction.

Text is treated as UTF-8, which is the detail most naive implementations get wrong: accented characters, non-Latin scripts, and emoji all survive a round trip here. Decoding accepts the URL-safe alphabet as well as the standard one, tolerates missing padding, and ignores stray line breaks — all three are common in real tokens and log files. If the decoded bytes turn out not to be text at all, it says so and shows the leading bytes as hex rather than printing nonsense.

There is also a file picker that turns any file into a data URI, ready to inline into CSS or an img tag. The file is read with the browser's own file API and never leaves your machine, which is also true of everything else on this page.

Common questions

Is Base64 a form of encryption?
No. It is an encoding with no key and no secret — anyone can reverse it instantly, as this page demonstrates. It exists to make bytes survive text-only transport, not to protect them. Never use it to hide anything.
When should I use the URL-safe alphabet?
When the value goes into a URL path, a query parameter, or a filename. Standard Base64 uses + and /, which have meaning in a URL, and = padding often gets mangled. URL-safe swaps in - and _ and drops the padding. JWTs use this variant throughout.
Why did my encoded string get about a third longer?
Base64 represents every three bytes as four characters, so output is roughly 133% the size of the input, plus padding. That overhead is the reason inlining large images as data URIs often makes a page slower rather than faster.
Does it handle emoji and non-English text?
Yes. The input is encoded as UTF-8 bytes first, so any Unicode text round-trips exactly. Implementations that call btoa directly on a string fail here — that is the source of the familiar “character out of range” error.

This page does the work itself, in this tab. Nothing you paste is sent to a server. Close the tab and no copy remains.