What is Base64 encoding?
Base64 is a way of representing binary data using only 64 printable ASCII characters, so it can travel safely in JSON, URLs, e-mail and HTML. This free Base64 encoder and decoder converts UTF-8 text and whole files to Base64 or data URIs, and decodes Base64 back into readable text or a downloadable file. A URL-safe variant is included. Everything is processed in your browser; nothing is uploaded.
How to encode or decode Base64
- 1
Choose Encode, Decode or File to Base64.
- 2
Type or paste your text, a Base64 string or a data URI, or drop a file.
- 3
Adjust the options: URL-safe alphabet, padding and line wrapping.
- 4
Copy the result, or download the decoded file when the Base64 contains binary data.
Key features
Full UTF-8 support
Accented letters, emoji and non-Latin scripts are encoded and decoded correctly, unlike the plain btoa function.
Files and data URIs
Convert images, PDFs and any other file to Base64 or to a ready-to-use data URI, and turn Base64 back into a downloadable file.
URL-safe Base64
Switch to the URL and filename safe alphabet from RFC 4648 (- and _ instead of + and /) and remove the padding.
Forgiving decoder
Accepts whitespace, missing padding, both alphabets and data: prefixes, and tells you when the input is not valid Base64.
Frequently asked questions
What is Base64 used for?
Base64 embeds binary data in text-only formats such as JSON, XML, HTML, CSS and e-mail. Common examples are data URIs for small images, HTTP Basic authentication headers and the parts of a JWT.
Is Base64 encryption?
No. Base64 is only an encoding and anyone can decode it instantly. Never use it to protect passwords or secrets.
Why does Base64 make data bigger?
Every 3 bytes of input become 4 characters of output, so Base64 is about 33% larger than the original data.
What is URL-safe Base64?
URL-safe Base64 replaces + with - and / with _ and usually drops the = padding, so the result can be used in URLs and file names without escaping. JWTs use this variant.
How do I convert an image to Base64?
Select File to Base64, drop the image and copy the result. Keep “Include data URI prefix” on to get a string you can paste into an HTML img tag or a CSS url().
Are my files uploaded?
No. Encoding and decoding happen locally in your browser, so text and files never leave your device.