How to Encode or Decode Base64
Paste plain text to encode it to Base64, or paste a Base64 string to decode it back to plain text.
Choose the appropriate operation. The result appears instantly below.
Click Copy to copy the encoded or decoded result to your clipboard.
What Base64 does, in plain terms
Base64 rewrites any data — text, an image, a PDF — using only 64 harmless characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, which is why the result is about one third larger. It exists for places that can carry text but not raw bytes: email bodies, JSON, XML, HTML and CSS.
Examples from this tool
| Input | Base64 |
|---|---|
Hi | SGk= |
Hello | SGVsbG8= |
Zürich | WsO8cmljaA== |
{"id":7} | eyJpZCI6N30= |
- It is not encryption. Anyone can decode Base64 in a second. Never use it to hide passwords or keys.
- The = at the end is padding. It fills the last group up to four characters and carries no data.
- Text is treated as UTF-8. Letters such as ü, š or é and emoji encode and decode correctly here. Tools that assume plain ASCII produce a different result or an error for the same text.
- "Invalid Base64 string" usually means stray characters: line breaks from an email, a missing piece at the end, or the URL-safe variant, which uses - and _ instead of + and /. Replace those two characters and try again.
Encoding a file
- Encode File reads a file from your device and shows its Base64 text. Nothing is uploaded.
- To embed a small image directly in HTML or CSS, put
data:image/png;base64,in front of the result (use the right type:image/jpeg,image/svg+xmland so on). - Keep embedded files small. A 30 KB icon becomes 40 KB of text inside your page and cannot be cached separately. For anything larger than a few kilobytes, a normal image file is the better choice.
Related: the URL encoder makes text safe for links, and the hash generator creates fingerprints that cannot be reversed.
Frequently Asked Questions
Is Base64 encryption?
No. Base64 is encoding, not encryption. Anyone can decode Base64 instantly. Never use it to protect sensitive data.
Why does Base64 make data larger?
Base64 converts every 3 bytes into 4 ASCII characters, resulting in ~33% size increase. This trade-off ensures safe text-based transmission.
What is Base64URL?
Base64URL replaces + with - and / with _ for use in URLs and filenames. It is commonly used in JWT tokens.
Can I encode files or images?
This tool encodes text. To Base64-encode a file, you need to read it as binary data first using programming language libraries.