Base64 Encoder / Decoder
Encode text or files to Base64, or decode Base64 strings back to readable text.
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.
How to Use This Tool
Encode or decode in three steps — no account, no limits.
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.
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.
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.
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.
Frequently Asked Questions
Quick answers to the most common Base64 questions.
= signs?
+
= 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.
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.
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.
+ 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.
= characters to get an exact multiple of 4 characters before decoding works correctly.