What Is Base64? How to Encode and Decode Text & Images (Free Tool)
Table of Contents
- What Is Base64?
- Why Developers Use Base64
- Encode and Decode in Two Steps
- Base64 or URL encoding — which one?
- Base64 in APIs and JSON
- FAQ
- Is Base64 encryption? No. Base64 is encoding, not encryption. Anyone can decode it. It only changes how the data is represented, not its security.
- Does Base64 make data smaller? No — it makes it about 33% larger (3 bytes become 4 characters).
- Why does a Base64 string end with = The = sign is padding, added when the data length is not a multiple of 3. Not every Base64 string has it.
- I decoded a file and got a blank image. What went wrong? The file may be corrupt, or you copied only part of the string. Decode the complete string; if it is an image, copy the full data:image/...;base64,... or the entire Base64 block.
What Is Base64?
Base64 is an encoding that converts binary data (images, files, PDFs) into a plain-text format made of letters, numbers, and a few symbols: A–Z, a–z, 0–9, plus + and /. It exists because most network protocols and file formats (email, JSON, URLs) only safely carry text.
The name comes from the 64 characters in its alphabet. Every 3 bytes of binary data become 4 Base64 characters, and padding = is added when data does not divide evenly by three.
Why Developers Use Base64
- Email attachments — old email servers only carried 7-bit text, so attachments were Base64-encoded (this is what MIME does).
- Embedding images in HTML/CSS — a small image can be inlined as a data URI instead of a separate file:
- JSON payloads — binary data inside JSON must be text, so files are Base64-encoded before being sent.
- JWT tokens — the header and payload of a JWT are Base64-encoded JSON.
Encode and Decode in Two Steps
- Paste your text, or drop a file, into the Base64 Encoder.
- Click encode — you get a Base64 string you can paste into email, JSON, or a URL.
To go the other way, paste the Base64 string into the Base64 Decoder and decode it back to the original text or file.
Base64 or URL encoding — which one?
Base64 is not the same as URL encoding:
| Encoding | Used for | Example |
|---|---|---|
| Base64 | Binary to text (images, files) | dG9vbHBpbG90 |
| URL encoding | Special characters in a URL | hello world → hello%20world |
If your data contains spaces, &, or ? inside a link, use the URL Encoder instead of Base64.
Base64 in APIs and JSON
Many APIs accept Base64-encoded files:
- Images — upload an avatar as a Base64 string inside a JSON body.
- PDFs and documents — send a Base64 file in a webhook payload.
- Snippets — encode small executable scripts for testing.
When you decode an API response, paste the string into the Base64 Decoder to extract the original file. For cleaning up the surrounding JSON, format it first with the JSON Formatter.
FAQ
Is Base64 encryption? No. Base64 is encoding, not encryption. Anyone can decode it. It only changes how the data is represented, not its security.
Does Base64 make data smaller? No — it makes it about 33% larger (3 bytes become 4 characters).
Why does a Base64 string end with = The = sign is padding, added when the data length is not a multiple of 3. Not every Base64 string has it.
I decoded a file and got a blank image. What went wrong?
The file may be corrupt, or you copied only part of the string. Decode the complete string; if it is an image, copy the full data:image/...;base64,... or the entire Base64 block.
Encode, decode, and verify your data with the free Base64 Encoder and Base64 Decoder — everything runs in your browser.
Related Free Tools
Advertisement
Tools We Recommend
Angel One
IndiaOpen a free Demat & trading account. All trades at ₹20, quick SIP in Direct Mutual Funds, and ₹1 lakh MTF at 0% interest.
Surfshark VPN
PrivacyFast, secure VPN for privacy and unrestricted browsing.
1Password
Secure password manager for teams and individuals.
NordVPN
PrivacyTop-rated VPN with threat protection and high-speed servers.
Affiliate links — we may earn a commission at no cost to you
Advertisement
Get tool tips & updates
Get weekly tips on free tools, shortcuts & productivity hacks. Confirm your email to subscribe — it only takes a second.
Related Articles
Base64 Encoder/Decoder: What It Is and How to Use It
Learn what Base64 encoding is, when to use it, and how to encode/decode strings instantly with our free developer tool.
Image Resizer: How to Resize Images for Different Platforms
Resize images for social media, websites, and print without losing quality. Free online image resizer with custom dimensions.
How to Combine Images Into One PDF (JPG to PDF in Seconds)
Merge JPG, PNG and WebP images into one PDF in seconds — free, private and no watermark. Step-by-step guide for phone and desktop.