Base64 encoder & decoder
Encode text or any file to Base64 and decode it back as you type. Standard, URL-safe, MIME and data URIs, with errors shown at their exact position and decoded files recognised by type.
- Text as UTF-8, files byte for byte
- URL-safe and standard detected
- Runs in your browser
- Input—Text or file
- Bytes—What is encoded
- Alphabet—64 characters
- Result—Characters
Base64 details
Details
What went in and what came out.
Type or paste something above.
Preview
Decoded images, text and bytes appear here.
Nothing to preview yet.
What Base64 does
Base64 writes any bytes, from text to images, with 64 safe characters, so they survive systems that only expect text, such as JSON, email and HTML.
3 bytes become 4 characters
Every 24 bits are split into four 6-bit groups, each written as one of A–Z, a–z, 0–9, + and /. That is why the result is about 33% longer.
= fills the last group
When the input is not a multiple of 3 bytes, one or two = signs pad the result to a multiple of 4 characters. URL-safe Base64 often leaves them out.
Text becomes bytes first
Text is turned into UTF-8 bytes before encoding, so é is 2 bytes and most emoji 4. Decoding must use the same character set to get the text back.
Encoding, not encryption
There is no key. Anyone can decode Base64, so it never protects passwords, tokens or personal data.
Base64 variants you will meet
Same idea, different alphabet, padding or line length. The decoder accepts all of them.
| Variant | Defined in | Characters | Padding | Where you see it |
|---|---|---|---|---|
Standard |
RFC 4648, section 4 | A–Z a–z 0–9 + / | Yes | JSON APIs, email attachments, Kubernetes secrets |
URL-safe (base64url) |
RFC 4648, section 5 | A–Z a–z 0–9 - _ | Usually no | JWTs, URL parameters, file names |
MIME |
RFC 2045 | Standard, lines of 76 | Yes | Email bodies and attachments |
PEM |
RFC 7468 | Standard, lines of 64 | Yes | Certificates and keys between -----BEGIN and -----END lines |
Data URI |
RFC 2397 | Standard after a data: prefix | Yes | Small images and fonts inside HTML or CSS |
How to use this tool
From text or a file to Base64 and back.
Pick encode or decode
Encode turns text or a file into Base64; decode turns Base64 back into text or a file.
Type, paste or open a file
The result updates as you type. Files are read on your device, up to 10 MB.
Choose the form
Standard, URL-safe, MIME or a data: URI when encoding; text, Latin-1 or hex when decoding.
Copy or download
Copy the result, or download it. Decoded files keep their real type and extension.
What this tool does, and what it doesn't
A plain list, so you know exactly what to expect.
This tool does
- Encode text as UTF-8 and files as bytes
- Make standard, URL-safe and MIME Base64
- Build data URIs with HTML and CSS
- Show where invalid input goes wrong
- Recognise and preview decoded files
- Decode JWT header and payload
This tool does not
- Send your data to our server
- Encrypt, hash or protect anything
- Verify JWT signatures
- Compress data or make it smaller
- Handle files larger than 10 MB
- Keep a history of what you convert
Where your data goes
Nowhere. Encoding, decoding and previews run in your browser, and files are read on your device. Nothing you type or open is sent to our server or stored. Like any website, our server keeps normal access logs of page visits, as described in our privacy policy.
Beginner's guide by Bhavin J. Sheth.
Why your results might look unexpected
The six surprises people run into most, and what each one means.
Invalid character
Quotes, %3D instead of = or a stray symbol was copied with the text. The position is shown.
Garbled or � characters
The data is a file, not text, or uses an older character set. Try Latin-1 or hex.
Impossible length
One character too many or too few, usually a string cut off when it was copied.
Both + and - in the input
Standard and URL-safe alphabets are mixed, often from two different sources.
Three parts separated by dots
That is a JWT. The tool decodes its header and payload; it does not verify it.
The result is longer
Base64 is always about 33% larger than the bytes it holds. It never compresses.
Questions about Base64
Is Base64 a form of encryption?
No. Base64 only changes how bytes are written, using 64 letters, digits and symbols, so they can travel through systems that expect text. It uses no key, and anyone can decode it in a second. Never use it to hide passwords, API keys or personal data; use real encryption such as AES, or a password hash such as bcrypt or Argon2.
Why is the Base64 result about a third longer?
Base64 turns every 3 bytes into 4 characters, so the output is 4/3 of the input, rounded up to a multiple of 4 with = padding. That is about 33% more, plus line breaks in MIME style. Text with accents or emoji also grows before encoding, because those characters take 2 to 4 bytes in UTF-8.
What is URL-safe Base64?
Standard Base64 uses + and /, which have a meaning in URLs and file names. The URL-safe alphabet from RFC 4648, often called base64url, uses - and _ instead, and usually leaves out the = padding. JSON Web Tokens use it. When decoding, this tool recognises both alphabets automatically.
Why does my Base64 fail to decode?
The usual causes are characters outside the alphabet, such as quotes or a stray character copied with the text; a mix of the standard and URL-safe alphabets; = padding in the middle; or a string that was cut off, which leaves an impossible length. The tool shows the position of the first problem. Spaces, line breaks and missing padding are fixed for you.
Can I encode an image or other file?
Yes. Choose Open file in Encode mode and the tool encodes the file's raw bytes, up to 10 MB, without changing them. Pick Data URI to get a data:image/png;base64,... string with ready-to-copy HTML and CSS. Data URIs suit small icons; large images are better served as normal files that browsers can cache.
Why does the decoded text look garbled?
Either the data is not text at all, such as an image or a ZIP file, or the text was written in an older character set than UTF-8. The tool recognises common file types from their first bytes and offers a download with the right extension. For old Western European text, switch the output to Latin-1; for anything else, use the hex view.
Is my data sent to your server?
No. Encoding and decoding run entirely in your browser, including files you open, and nothing you type or open is sent to our server or stored. Like any website, our server keeps normal access logs of page visits, as described in our privacy policy.