How to use it
- To encode, choose Encode text and type or paste your text. The Base64 appears as you type.
- To decode, choose Decode to text and paste Base64. Both the standard and the URL-safe alphabet are accepted, line breaks and spaces are ignored, and missing padding is added for you.
- To turn a file into Base64, such as a small image you want to embed in CSS or HTML, choose File to Base64 and pick the file. Tick Add a data: URI prefix to get something you can use directly as an image source.
- Use Copy to take the result, or Use result as input to check a round trip.
What Base64 is, and what it is not
Base64 writes binary data using 64 printable characters (letters, digits, + and /), so it can travel through systems that only handle text, such as email, JSON or a URL. The result is about a third larger than the original.
It is an encoding, not encryption. Anyone can decode it, so never use it to hide a password or other secret.
UTF-8 and non-English text
The browser’s built-in btoa function breaks on any character outside Latin-1. This tool first turns your text into UTF-8 bytes and encodes those, so accented letters, other scripts and emoji survive a round trip. When you decode, the bytes are read back as UTF-8; if they are not valid UTF-8 text (for example when the Base64 is a picture), the tool tells you and offers the raw bytes as a download.
URL-safe Base64
The standard alphabet uses + and /, which have special meanings in URLs. The URL-safe variant uses - and _ instead, and often leaves off the trailing = padding. It is the form used in JSON Web Tokens, which you can read with the JWT decoder.
Related tools
URL encoder and decoder, hash generator and JWT decoder.
Frequently asked questions
No. Encoding and decoding happen in your browser. Files are read locally and nothing is sent to CodeROG or anyone else.
No. It only changes how the data is written. Anyone can reverse it in a second. Use real encryption for secrets.
The input contains a character that is not part of the Base64 alphabet, or its length cannot be right (a length of 1 more than a multiple of 4 is never valid). Check for stray quotes or a prefix such as data:image/png;base64,; the tool removes a data: prefix, but not other text.
The Base64 probably holds binary data such as an image or a compressed file, not text. Use Download bytes to save it and open it with the right program.
Files are limited to 5 MB, because Base64 of a large file makes a very long line that is slow to show and copy.