Base64 Encoder/Decoder
Encode and decode Base64 strings, files, and images.
Why I Built This Base64 Tool
I needed a quick way to encode and decode Base64 without opening a terminal or writing a script every time. Whether I'm debugging JWT tokens, embedding images in CSS, or decoding some mystery string from an API, this tool handles it all.
What I Use It For
- Text Encoding - Convert any text to Base64 for embedding in configs or APIs
- Text Decoding - Figure out what's actually in that encoded string
- Image Support - Convert images to data URIs and preview Base64 images instantly
- File Upload - Drag any file to get its Base64 representation
- URL-Safe Mode - When I need to put Base64 in a URL without breaking things
- Drag & Drop - Just drag an image onto the page, that's it
I often use this with the URL Encoder when building API requests and the Hash Generator to verify file integrity.
What is Base64?
Base64 converts binary data to text using 64 safe ASCII characters. I use it constantly for:
- Embedding small images in HTML/CSS (data URIs)
- Encoding email attachments
- Storing binary data in JSON configs
- Sending files through text-based APIs
The encoding is standardized in RFC 4648, which also covers URL-safe variants.
URL-Safe Base64
Standard Base64 uses + and / characters, which cause problems in URLs. URL-safe Base64 replaces these with - and _. I always use URL-safe mode when the encoded string will end up in a query parameter or filename.
How I Use Base64 in Real Projects
In JavaScript, I use btoa() and atob() for quick encoding, but honestly this tool is faster when I just need to check something. In Node.js, I use the Buffer class. For APIs that accept binary data, Base64 encoding is usually the easiest way to include files in JSON payloads.
HTTP Basic Auth headers use Base64 for credentials (username:password encoded). When uploading files through APIs, I convert them to Base64 first. Pro tip: for large files, consider chunking to avoid memory issues. And in Kubernetes secrets, Base64 encoding is how you store certificates and keys as text.
When to Embed Images as Base64
Embedding images as Base64 eliminates extra HTTP requests, which can speed up page loads. I use this technique for small icons and logos under 10KB. For CSS backgrounds, data URIs mean the image loads with the stylesheet. This is especially useful for critical above-the-fold images.
Email templates are where Base64 images really shine. Many email clients block external images by default, but embedded ones display immediately. For SPAs with offline support, I store sprite sheets as Base64 in the JavaScript bundle. But don't go overboard, since Base64 increases file size by 33%. For large images, external loading with HTTP/2 is usually better.
Related Articles
- Base64 Encoding: When and Why to Use It
- Debugging APIs with Base64 and JWT Decoding
- Image to Base64: When Embedding Makes Sense
Frequently Asked Questions
Is my data secure?
Yep, everything runs locally in your browser. I use this with production data myself, so I made sure nothing gets sent anywhere.
Is Base64 encryption?
Nope, and this is important. Base64 is encoding, not encryption. Anyone can decode it instantly. If you need security, use proper encryption. Base64 is just for converting binary to text, not for hiding data.
Why does Base64 make data larger?
Base64 increases size by about 33% because it uses 4 ASCII characters to represent every 3 bytes of data. That's the trade-off for being able to include binary data in text formats like JSON or HTML.