Developer Tools

Base64 Encoder / Decoder

Encode text or files to Base64, or decode Base64 strings back to readable text.

100% Private Instant Results Works Offline Free Forever
Plain Text Input
0 characters
Base64 Output
0 characters
🔐

What is Base64?

Base64 is an encoding scheme that converts binary data into a string of ASCII characters using 64 printable symbols — A–Z, a–z, 0–9, +, and /. It's not encryption — it's a way to safely represent binary data as plain text so it can travel through systems that only handle text reliably.

⚙️

How Does It Work?

Base64 takes every 3 bytes of input (24 bits) and splits them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters in the Base64 alphabet. If the input isn't divisible by 3, padding = characters are added to the end to complete the group.

📏

Size Overhead

Base64-encoded output is always roughly 33% larger than the original input. This is the inherent tradeoff: every 3 bytes of binary data becomes 4 characters of Base64 text. For small payloads this is usually acceptable. For large files, consider whether Base64 is the right approach.

🛡️

Is It Safe?

Base64 is encoding, not encryption. Anyone with the Base64 string can immediately decode it back to the original. Don't use Base64 to protect sensitive data — use proper encryption for that. Base64's job is safe transport, not secrecy.

Guide

How to Use This Tool

Encode or decode in three steps — no account, no limits.

1

Choose a mode

Click Encode to Base64 if you have plain text or file data you want to convert. Click Decode from Base64 if you have a Base64 string you want to read as plain text.

2

Paste your input or upload a file

Type or paste directly into the input box on the left. For files — images, PDFs, documents — click Upload a file and the tool will read its contents automatically. Maximum recommended file size is 5MB for smooth in-browser processing.

3

Convert and copy

Click the convert button and the result appears instantly on the right. Hit Copy to grab it to your clipboard, or Download to save it as a .txt file. Use Swap to flip the input and output if you need to go the other direction.

Use Cases

When Do You Actually Need Base64?

More common than you'd think — here's where it shows up most.

🖼️

Embed Images in HTML or CSS

Convert a small image to Base64 and paste it directly as a data:image/png;base64,… URI inside HTML or CSS. No separate image file needed — useful for icons, logos, and email templates.

🔑

API Tokens & Auth Headers

HTTP Basic Authentication encodes credentials as username:password in Base64. Many APIs also transfer tokens and keys in Base64 format inside Authorization headers.

📧

Email Attachments

The MIME standard that powers email attachments uses Base64 to encode binary files — PDFs, images, documents — so they can travel safely through text-only email infrastructure without getting corrupted.

🌐

URL-Safe Data Transfer

URLs can't safely contain certain characters. Base64 (especially URL-safe Base64, using - and _ instead of + and /) is widely used to pass binary data safely inside URL parameters.

💾

JSON Payloads with Binary Data

JSON is text-only. When an API needs to include binary content — an image, a file, a certificate — inside a JSON payload, Base64 is the standard approach to convert that binary into a JSON-safe string.

🔍

Debugging Encoded Data

You'll regularly encounter Base64 strings in JWT tokens, cookie values, API responses, and config files. Decoding them instantly lets you inspect what's actually inside without needing to write code.

FAQ

Frequently Asked Questions

Quick answers to the most common Base64 questions.

Is Base64 the same as encryption? +
No — Base64 is encoding, not encryption. Anyone who has a Base64 string can decode it back to the original instantly, with no key or password required. It exists to make binary data safe to send through text-based systems, not to hide or protect that data. If you need to protect sensitive information, use a proper encryption algorithm like AES.
Why does Base64 output end with = signs? +
Base64 groups input into chunks of 3 bytes. If the input length isn't a multiple of 3, padding characters (= or ==) are added to fill out the final group to the required length. One = means one byte of padding was needed; == means two bytes. If the input length is already divisible by 3, there are no padding characters at all.
Does this tool send my data to a server? +
No. This tool runs entirely inside your browser using JavaScript's built-in btoa() and atob() functions (and FileReader for files). Your input never leaves your device. There's no backend processing, no server logs, and nothing is stored anywhere.
Can I encode images or binary files, not just text? +
Yes — use the file upload option. The tool uses the browser's FileReader API to read the file as a data URL, which automatically includes the Base64-encoded content. This works for images, PDFs, and most other file types. For very large files, processing may take a moment.
Why does Base64 output look bigger than the input? +
Base64 encoded data is always approximately 33% larger than the original. This is because every 3 bytes of input becomes 4 characters of output — a fixed overhead built into how the encoding works. For short strings the difference is small, but for large files it adds up noticeably.
What's the difference between standard Base64 and URL-safe Base64? +
Standard Base64 uses + and / as the 62nd and 63rd characters, which are special characters in URLs and can cause problems if used in query strings. URL-safe Base64 replaces them with - and _ respectively, making it safe to include directly in URLs without percent-encoding. Both variants use the same overall scheme — just those two characters differ.
How do I decode a JWT (JSON Web Token) using this tool? +
A JWT has three parts separated by dots. Copy the second segment (the payload) — that's the Base64-encoded JSON. Switch to Decode mode, paste it in, and click decode. You'll see the raw JSON claims that were inside the token. Note that JWT uses URL-safe Base64 without padding, so you may need to add = characters to get an exact multiple of 4 characters before decoding works correctly.