Data URIs
data:image/svg+xml;base64,... embeds an image directly in CSS or HTML, trading file size
for one fewer request. Paste a whole data URI into the decoder — the prefix is handled.
Encode text to Base64 or decode it back. Unicode is handled properly, the URL-safe alphabet is one tick away, and data URIs are recognised automatically.
Base64 turns arbitrary bytes into 64 printable characters, so binary data can travel through channels that only handle text. It is an encoding, not encryption — anyone can decode it, and this page is proof of that.
Three characters per four output characters: encoding always makes data about 33 percent larger. That is the cost of the guarantee that nothing in the output will be mistaken for a control character or a delimiter.
data:image/svg+xml;base64,... embeds an image directly in CSS or HTML, trading file size
for one fewer request. Paste a whole data URI into the decoder — the prefix is handled.
MIME has encoded attachments this way since 1992. It is why the 76-character wrap option exists — that is the line length email requires.
Authorization: Basic dXNlcjpwYXNz is just user:pass encoded. Anyone
watching the connection can read it, which is why Basic auth needs HTTPS.
A JWT is three Base64url segments joined by dots. Decode the first two and you can read the header and payload — they are not secret. Only the signature stops them being altered.
Kubernetes secrets, certificates and private keys are frequently stored Base64-encoded. Encoded, not protected.
JSON has no binary type, so file contents inside a JSON payload are Base64. This is why uploading an image as JSON costs a third more bandwidth than a multipart form.
Standard Base64 uses + and / as its last two characters and pads with
=. All three mean something in a URL: + decodes to a space in a query string,
/ is a path separator, and = separates a parameter from its value.
The URL-safe variant (RFC 4648 §5) swaps them for - and _ and drops the padding.
It is what JWTs use, and what you want for anything that goes in a URL or a filename.
JavaScript's built-in btoa throws on any character above U+00FF, which is why so many
Base64 tools mangle accented characters, emoji and non-Latin scripts. This one encodes to UTF-8 bytes first,
so café, 日本語 and 🎨 all round-trip exactly.
café 日本語 🎨
-> Y2Fmw6kg5pel5pys6KqeIPCfjqg=
-> café 日本語 🎨
Base64 is reversible by design and requires no key. Encoding a password, an API token or personal data hides it from a casual glance and from nobody else.
If you need something to stay secret in transit, use TLS. If it needs to stay secret at rest, use real encryption. If you need to verify a value without storing it, use a password hash such as Argon2 or bcrypt. Base64 is for none of these things — it is for getting bytes safely through a text channel.
const enc = btoa(String.fromCharCode(...new TextEncoder().encode(text)));
const dec = new TextDecoder().decode(
Uint8Array.from(atob(enc), c => c.charCodeAt(0))
);
import base64
base64.b64encode(text.encode("utf-8")).decode("ascii")
base64.b64decode(encoded).decode("utf-8")
base64.urlsafe_b64encode(data) # - and _ instead of + and /
base64 file.png > file.b64
base64 -d file.b64 > file.png
No. Encoding and decoding happen in your browser. That matters here more than on most pages, because Base64 so often contains credentials, tokens and private keys.
Usually because the input was binary rather than text — an encoded image or PDF has no readable form. Occasionally it is an encoding mismatch: the data was encoded from a legacy character set rather than UTF-8. This decoder assumes UTF-8, which is correct for almost everything written this century.
Use Open file to load a text file. Binary files such as images are not supported here — the input panel is a text field. For an image data URI, the command line (base64 file.png) is the tool for the job.
Padding. Base64 works in groups of three input bytes, and = marks a final group that was short. You will see none, one or two. The URL-safe variant drops them, and the decoder here adds them back when they are missing.
No. There is no key and it is trivially reversible — this page reverses it. Encoding solves transport, encryption solves secrecy, and they are unrelated problems.
Longer reading on formatting, indentation and minification.