Base64 is an encoding that turns binary data — such as an image or a file — into a string of plain text using 64 safe characters. It's widely used to embed data in HTML, CSS, JSON and emails, where only text is allowed.
Base64 isn't encryption; it's just a reversible text representation, so anyone can decode it back.
Encode or decode text with Base64 Encode / Decode.
What Base64 does
Base64 represents arbitrary binary data using 64 printable characters. Every three bytes become four characters, which is why encoded data is always about a third larger than the original. It exists because many systems — email bodies, JSON strings, URLs, XML, config files — accept text reliably but corrupt raw binary. Encoding lets a file travel through those channels intact.
It is not encryption
This is the most consequential misunderstanding about Base64. There is no key and no secret: any decoder reverses it instantly, and a Base64 string is recognisable on sight by its alphabet and trailing equals signs. Credentials pasted as Base64 into a config file are stored in plain sight. Use it to transport data safely, never to protect it.
Base64 inside PDFs
PDFs are frequently moved around as Base64 — attached to an API response, embedded in a JSON payload, stored in a database column, or handed to a browser as a data URI so it can be displayed without a separate download. The cost is the 33% size increase, which is significant for a document that was already large. For anything sizeable, a real file transfer beats embedding.
Data URIs
A data URI is Base64 with a prefix declaring what the content is, so a browser can render it directly rather than fetching a file. It removes a network request, which is useful for a small icon and counterproductive for anything bigger: a data URI cannot be cached separately from the page containing it, so it is re-downloaded every time that page loads.
