Base64 Encode & Decode
Convert text or any file to Base64, or decode Base64 back to text, images and files. Make data URIs, use URL-safe Base64 and preview what you decode — privately, in your browser.
Ready-to-use code
How to Use the Base64 Converter
Turn text or files into Base64 for emails, APIs and web pages — or decode Base64 back to its original text or file.
Pick a mode
Choose Encode text, Encode file or Decode at the top of the tool.
Add your input
Type or paste text, drop any file up to 100 MB, or paste Base64 or a data URI to decode.
Choose your options
Pick UTF-8 or another character set, URL-safe Base64, line breaks or a data URI.
Copy or download
Copy the result, download it, or download the decoded file — images are previewed first.
Text
UTF-8, UTF-16, Latin-1
Files
Up to 100 MB
Images
Data URI + preview
Variants
URL-safe, no padding
Detects
15+ file types
Speed
Live conversion
Privacy
Nothing uploaded
Price
100% free
Base64 Converter Features
Everything you need to work with Base64, in one free tool.
Live encode and decode
The result updates as you type, and Swap sends it back as input to check the round trip.
Files and images
Encode any file up to 100 MB. Images get a ready data URI plus copy-paste HTML and CSS code.
Smart file detection
When Base64 holds a file, the tool spots the type — PNG, JPEG, PDF, ZIP, MP3, MP4 and more — previews images and lets you download it.
URL-safe Base64
Switch to Base64URL (- and _ instead of + and /) and remove = padding, as used by JWTs and web APIs.
Character sets
Encode and decode text as UTF-8, UTF-16LE or ISO-8859-1, so accents and emoji survive.
Line breaks
Wrap output every 76 characters for email (MIME) or 64 for PEM keys and certificates.
Forgiving decoder
Accepts data URIs, spaces, line breaks, URL-safe characters and missing padding — and tells you exactly where a bad character is.
Line by line
Encode each line separately — handy for lists of usernames or IDs.
Private by design
Everything runs in your browser. Text and files are never uploaded.
Where Is Base64 Used?
Base64 turns binary data into plain letters and numbers, so it can travel safely through systems built for text.
| Where | Why Base64 is used |
|---|---|
| Email attachments (MIME) | Email was designed for text, so attachments are sent as Base64 |
| Data URIs in HTML & CSS | Small images and icons can be embedded directly in a page |
| JSON & REST APIs | Images and files are sent inside JSON as Base64 strings |
| JSON Web Tokens | Each part of a JWT is Base64URL-encoded |
| HTTP Basic Auth | The username:password header is Base64-encoded — not encrypted |
| Keys & certificates (PEM) | Keys and certificates are Base64 between BEGIN and END lines |
How Much Bigger Does Base64 Make Data?
Base64 uses 4 characters for every 3 bytes, so output is about 33% larger.
| Original size | Base64 size | Notes |
|---|---|---|
| 3 bytes | 4 characters | The basic Base64 unit |
| 1 KB | ≈ 1.33 KB | Fine for small icons in CSS |
| 100 KB | ≈ 133 KB | Usually better served as a normal image file |
| 1 MB | ≈ 1.33 MB | Too big to embed in most pages |
| 10 MB | ≈ 13.3 MB | Use a file upload instead of Base64 where possible |
What Can You Use It For?
Common reasons developers and designers need Base64.
Embed images
Turn icons and small images into data URIs for HTML, CSS or email.
APIs & JSON
Encode files to send in JSON, or decode files you received.
Keys & tokens
Read Base64 values from JWTs, configs and environment variables.
Email debugging
Decode Base64 email bodies and attachments.
Basic Auth headers
Decode or build Authorization: Basic values.
Base64 to PDF
Turn a Base64 string from an API back into a PDF file.
Debugging
Check what’s really inside an encoded string.
Learning
See how text becomes Base64, character by character.
Tips for Working With Base64
- Base64 is not encryption. Anyone can decode it — never use it to hide passwords or secrets.
- Pick the right variant. Use URL-safe Base64 for URLs, file names and JWTs.
- Keep embedded images small. Data URIs are best for icons under about 10 KB.
- Match the character set. If decoded text looks garbled, try UTF-16LE or ISO-8859-1.
- Use the data URI prefix. Paste a full data:… string and the file type is used automatically.
- Check the round trip. Click Swap to decode your result and confirm you get the original back.
Private by Design
Everything happens in your browser. What you paste and any files you open are never sent to Toolszu or anyone else, and nothing is stored.
That matters for developer tools: tokens, keys and links often contain sensitive data. Here they stay on your device.
Frequently Asked Questions
Answers about Base64 encoding, decoding, images and files.
Base64 is a way of writing any data — text, images or files — using only 64 safe characters: A–Z, a–z, 0–9, + and /. It lets binary data travel through systems that only handle text, such as email, JSON and URLs.
Click Decode and paste your Base64 or data URI. Text appears straight away. If the Base64 contains a file, the tool tells you the file type, previews images and lets you download it.
Click Encode file and drop your image. You get the Base64 as a data URI, plus ready-to-paste HTML (img src) and CSS (background-image) code.
Click Decode and paste the Base64. The tool detects that it’s an image or PDF, shows a preview for images and gives you a download button with the right file extension.
No. Base64 is an encoding, not encryption — anyone can decode it in seconds. Use real encryption for anything secret.
URL-safe Base64 (Base64URL) replaces + with - and / with _ and often drops the = padding, so the result can be used in URLs, file names and JSON Web Tokens without being changed.
The = signs are padding that make the length a multiple of 4. One = means the last group had 2 bytes, two means it had 1. Many systems drop them, and this decoder works either way.
The text was probably encoded with a different character set. Try switching from UTF-8 to UTF-16LE or ISO-8859-1. If it still looks wrong, the Base64 may contain a file rather than text.
About 33% bigger, because every 3 bytes become 4 characters. Line breaks add a little more.
You can encode files up to 100 MB. Very long results show a shortened preview, but Copy and Download always include the full Base64.
No. Encoding and decoding happen in your browser. Your text and files never leave your device.
Yes, it’s completely free with no sign-up and no limits.
Related Free Tools
Encode or Decode Base64 Now
Paste text or drop a file and convert it instantly. Free, private and no sign-up.
Start Now