Base64 Encoder & Decoder
Encode text and files to Base64 or decode Base64 back, with URL-safe and data URI options.
How to use the Base64 Encoder & Decoder
- 1Type or paste text, or switch to File and drop any file.
- 2Choose Encode or Decode. The result updates as you type, and data: URIs, URL-safe Base64 and missing padding are detected on their own.
- 3Copy or download the result. Decoded images are previewed and can be saved with the right file extension.
About Base64 Encoder & Decoder
The Base64 Encoder & Decoder converts text and files to Base64 and back. For text you choose the character set used to turn characters into bytes, and you can encode or decode each line separately. Files of any type can be dropped in and encoded, and the output can be plain Base64, a data URI, a CSS url() value or an HTML img tag, with the MIME type detected from the file.
Options include URL-safe Base64URL, padding with =, and line wrapping at 64 or 76 characters for PEM files and MIME email bodies, with Windows line breaks if needed. When decoding, the tool recognizes data URIs, Base64URL and missing padding on its own, can skip invalid characters such as quotes, and lets you read the decoded bytes as UTF-8, UTF-16, Latin-1 or Windows-1252. Decoded images are previewed, and binary results can be saved as a file with the right extension.
Typical uses are embedding small images or fonts in HTML and CSS, reading Base64 values from APIs, config files and email sources, creating basic auth headers, and checking the payload of tokens. The Base64 decoder is also a quick way to turn a Base64 string back into an image.
Frequently asked questions
What is Base64 used for?
Base64 turns any bytes into plain ASCII letters, digits, + and /, so binary data can travel through systems built for text: email attachments, data: URIs in HTML and CSS, JSON payloads, basic auth headers and JSON Web Tokens.
What is the difference between Base64 and Base64URL?
Base64URL replaces + with - and / with _ and usually drops the = padding, so the result can sit in a URL or a file name without further escaping. JWTs use it. The decoder here reads both.
Why is the Base64 output larger than the input?
Every 3 bytes become 4 characters, so encoded data is about 33% larger, plus line breaks if you wrap the output.
Is Base64 encryption?
No. Anyone can decode it instantly. It only changes how data is written, not who can read it. Use the File Encryption tool if you need to protect something.
Why does my decoded text look garbled?
The bytes were probably written in another character set. Switch "Show text as" to Windows-1252, Latin-1 or UTF-16 and see which one reads correctly. If the data is a file, such as an image or PDF, it is shown as a file with a download button instead.
More in Encode & Format
Percent-encode or decode URLs and query strings, and edit every URL part in a table.
Escape text as named, decimal or hex HTML entities, or decode entities back to text.
Format, minify and validate JSON with exact error positions, sorted keys and string escaping.