Base64 Encode & Decode.
Convert text and files to and from Base64 — UTF-8 aware, with URL-safe support. Everything stays in your browser.
What is Base64?
Base64 is a way to represent arbitrary binary data using only 64 safe ASCII characters (A–Z a–z 0–9 + /). Every 3 bytes of input become 4 output characters, which makes the result about 33% larger — but safe to embed in text-only places like JSON, XML, e-mails, or data URIs. It is an encoding, not encryption: anyone can reverse it instantly.
How “Man” becomes “TWFu”
The three bytes of Man (77, 97, 110) form 24 bits, which are re-grouped into four 6-bit numbers — each an index into the Base64 alphabet:
| Text | M | a | n |
|---|---|---|---|
| Bits | 01001101 01100001 01101110 | ||
| 6-bit groups | 010011 010110 000101 101110 | ||
| Base64 | T W F u | ||
Where Base64 is used
- Data URIs — inline images and fonts in HTML/CSS (data:image/png;base64,…).
- JWTs — header and payload of JSON Web Tokens are Base64URL-encoded (try our JWT decoder).
- E-mail attachments — MIME encodes binary attachments as Base64 with 76-character lines.
- APIs — binary payloads in JSON, and HTTP Basic authentication credentials.
Base64 vs. Base64URL
Standard Base64 uses + and / — both problematic inside URLs. The URL-safe alphabet (RFC 4648 §5) swaps them for - and _ and typically omits the = padding. Use the URL-safe option whenever the encoded value ends up in a URL, filename, or JWT. Decoding here accepts both variants automatically.
Base64 in your code
For anything beyond a quick conversion, encode directly in your language of choice — mind the UTF-8 handling in JavaScript:
// Encode (UTF-8 safe)
const bytes = new TextEncoder().encode("Hellö wörld");
const b64 = btoa(String.fromCharCode(...bytes));
// Decode
const decoded = new TextDecoder().decode(
Uint8Array.from(atob(b64), (c) => c.charCodeAt(0))
);import base64
b64 = base64.b64encode("Hellö wörld".encode()).decode()
text = base64.b64decode(b64).decode()
# URL-safe variant
url_b64 = base64.urlsafe_b64encode(b"data").decode()Frequently asked questions
Is Base64 encryption?
Is it safe to paste sensitive data into this tool?
What does the = at the end of a Base64 string mean?
Why is Base64 larger than the original data?
What is the difference between Base64 and Base64URL?
Why does my decoded text look garbled?
Can I encode or decode files?
Free tools from a European software company.
- Runs in your browser
- Made & hosted in the EU
- No account needed