How to encode or decode Base64
- Choose Encode or Decode.
- Type text or pick a file to encode, or paste Base64 to decode.
- Copy the result, or preview and download a decoded image.
Where Base64 is used
Data URLs that embed images in HTML or CSS, email attachments (MIME), Basic authentication headers, JSON fields that carry files, and the parts of a JWT are all Base64.
UTF-8 and the btoa problem
The browser's btoa function only accepts Latin-1 and fails on emoji or non-English text. This tool converts text to UTF-8 bytes first, so the result matches what servers and command-line tools produce.
Data URLs and size
A data URL puts the whole file inside the page, saving a request but adding about a third to its size and preventing separate caching. It suits small icons; larger images are better as normal files.
Frequently asked questions
What is Base64?
A way to write binary data using 64 plain characters (A–Z, a–z, 0–9, + and /), so it can travel through text-only channels like JSON, email and URLs.
Is Base64 encryption?
No. Anyone can decode it. Never use Base64 to hide passwords or secrets.
Why is the encoded text larger?
Every 3 bytes become 4 characters, so Base64 is about 33% larger than the original.
What is URL-safe Base64?
A variant that uses - and _ instead of + and / and drops the = padding, so it can be used in URLs and file names. JWTs use it.
