Base64 Encoder and Decoder
Encode text (as UTF-8) or any file to Base64, with an optional URL-safe variant, and decode standard or URL-safe Base64 back to text or a downloadable file.
About the Base64 Encoder/Decoder
Base64 writes binary data with 64 printable characters (A–Z, a–z, 0–9, + and /), so it can travel through places that only accept text: JSON fields, data URIs in HTML and CSS, email bodies and HTTP headers. Every 3 bytes become 4 characters, which makes the encoded version about a third larger than the original. It is an encoding, not encryption: anyone can decode it.
Text is converted to UTF-8 bytes before encoding, so accented letters, the ₹ sign and emoji survive the round trip; "héllo" encodes to aMOpbGxv. The Encode a file button reads any file on your device and shows its Base64. For images and fonts, Copy as data URI adds a prefix such as data:image/png;base64, so you can paste the result straight into a CSS url() or an <img> tag. Tick URL-safe to get base64url (RFC 4648): - and _ instead of + and /, and no = padding, which is the form used in JSON Web Tokens and URL parameters.
The decoder accepts standard and URL-safe input and ignores spaces and line breaks, missing padding and a leading data:...;base64, prefix. If the decoded bytes are valid UTF-8 text they are shown; if not, for example when the Base64 holds an image, you can download the bytes as a file instead. A common job is reading the middle part of a JWT: decode it and you get the token's claims as JSON, which the JSON Formatter can lay out neatly. For percent-encoding or \u escapes, use the Character Encoding Converter.
How to use the Base64 Encoder/Decoder
- 1
Choose Encode or Decode
Use the switch at the top. In Encode mode you can also tick "URL-safe (base64url, no padding)".
- 2
Enter text or pick a file
Type or paste into the text box, or in Encode mode click Encode a file to choose any file from your device. In Decode mode, paste the Base64 string.
- 3
Run the conversion
Press Encode to Base64 or Decode from Base64. A file is encoded as soon as you choose it. Swap moves the output into the input box and switches mode.
- 4
Copy or download the result
Use Copy for the output, Copy as data URI after encoding a file, or Download decoded bytes when the decoded data is not text.
What it can do
UTF-8 text handling
Text in any language, including emoji, is encoded and decoded as UTF-8, the encoding most systems expect.
Files and data URIs
Encode images, PDFs, fonts or any other file, then copy the result with or without the data: prefix.
URL-safe output
base64url output without padding, ready for tokens, file names and query strings.
Forgiving decoder
Accepts both alphabets, wrapped lines, missing = padding and pasted data URIs, and explains what is wrong with invalid input.
Binary-aware decoding
When the decoded bytes are not text, the tool says so and lets you download them instead of showing garbled characters.
Limitations
- Decoded binary data is downloaded as decoded.bin. The tool does not detect the file type, so rename it with the right extension, such as .png or .pdf.
- Output is one continuous line; there is no option to wrap it at 76 characters as MIME email does.
- Large files produce very long strings: a 3 MB file becomes about 4 million characters. That can make the page slow, and the practical limit depends on your device's memory.
- Decoded text must be UTF-8. Text that was encoded from another character set, such as Windows-1252, is treated as binary.
Privacy
Text and files are encoded and decoded by JavaScript in your browser; nothing you enter or choose is uploaded to FlexyPdf's servers.
Frequently asked questions
Is Base64 a way to encrypt or hide data?
No. Base64 only changes how bytes are written down, and anyone can decode it with no key. Do not use it to protect passwords or personal data.
Why does the encoded text end with = or ==?
Base64 works on groups of 3 bytes. When the input length is not a multiple of 3, the last group is padded and marked with one or two = signs. URL-safe output leaves the padding off, and the decoder here works with or without it.
Can I read a JWT with this?
Yes. Copy the part between the two dots of the token, switch to Decode and press Decode from Base64; the claims appear as JSON. This only reads the token. It does not check the signature, so it cannot tell you whether the token is genuine.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs and file names. URL-safe Base64 (base64url) uses - and _ instead and usually drops the = padding. The decoder accepts either form.
Why does decoding say the bytes are not valid UTF-8 text?
The Base64 contains binary data, such as an image, a PDF or compressed data, rather than text. Use Download decoded bytes to save it, then rename the file with the correct extension.
Ratings & Reviews
Rate Base64 Encoder/Decoder
Help others by sharing your experience. Your rating is shown without your name.
More Converters
View all →CSV to JSON
Convert CSV rows into a JSON array of objects
JSON to CSV
Turn a JSON array of objects into CSV for Excel or Google Sheets
JSON to YAML
Convert JSON to YAML, or common YAML config files back to JSON
HEX to RGB
Convert HEX colour codes to RGB and HSL, and back