Base64 Encode & Decode
Turn text or a file into Base64, or decode Base64 back into readable text or the original file. It all runs on your device, so it's safe for tokens and private files.
BASE64
SGVsbG8gZnJvbSB0b29sLWtpdC5zcGFjZSDwn5GL
What this Base64 tool does
Encode turns text into Base64. Text is read as UTF-8, so accents, emoji and other scripts come back exactly as you typed them. Drop a file instead and you get the Base64 of the file itself, or a ready-made data URI.
Decode reads Base64 back. When the result is text, you see it straight away. When it's a file, such as an image or a PDF, the tool recognises the type and lets you download it with the right extension. Images show a preview.
The decoder is forgiving: it accepts URL-safe Base64, missing = padding, line breaks and a data: prefix, so you can paste whatever an email, API or config file gave you.
Where you run into Base64
- Email attachments. Email is a text format, so attachments travel as Base64.
- JSON Web Tokens. Each part of a JWT is URL-safe Base64. Decode the middle part to read the claims.
- Basic auth headers.
Authorization: Basicis followed byusername:passwordin Base64. That's why it must only be sent over HTTPS. - Images in HTML and CSS. Small icons are often inlined as data URIs to save a request.
- APIs and config files that need to carry binary data, such as keys or certificates, inside JSON or YAML.
When decoding fails
The most common causes are a character that isn't part of Base64 (often a stray quote or a space in the middle of a copied token), a = sign that isn't at the end, or text that was cut off while copying. The error message says which one it is and where.
How to encode or decode Base64
- 1
Pick Encode or Decode
Encode turns text or a file into Base64. Decode turns Base64 back into text, or into a file you can download.
- 2
Paste text or drop a file
Type or paste into the input pane, or drop a file onto it. The result updates as you type.
- 3
Copy or download
Copy the result to your clipboard, or download it. Decoded images show a preview first.
Frequently asked questions
Is my data uploaded?
No. Encoding and decoding run in JavaScript on your device, so text and files never leave your browser.
What is URL-safe Base64?
Standard Base64 uses + and /, which have a special meaning in URLs. URL-safe Base64 (also called base64url) uses - and _ instead and usually drops the = padding. It's what JWTs and many APIs use. The decoder reads both.
Why is the Base64 longer than the original?
Base64 stores every 3 bytes as 4 characters, so the result is about 33% larger. It's a way to send binary data through systems that only accept text, not a way to compress it.
Is Base64 encryption?
No. Anyone can decode Base64, so it hides nothing. Use it to move data safely through text-only channels, never to protect passwords or secrets.
What is a data URI?
A data URI puts a whole file inside a link, such as data:image/png;base64,iVBOR… You can use it as an image source in HTML or CSS, so small icons don't need a separate request.