Free Base64 Encoder / Decoder
Instantly encode any text, URL, or file to Base64 — or decode Base64 strings back to readable text. 100% client-side, secure, and private. Your data never leaves your browser.
How It Works
Encode & Decode Base64 in 3 Easy Steps
The fastest, most privacy-focused Base64 tool available online — no sign-up, no limits, no data stored.
Paste Your Text or Upload a File
Type or paste plain text to encode, or paste a Base64 string to decode it. Switch to the File tab to upload images, PDFs, or any binary file. Auto-detect mode intelligently identifies whether your input is already Base64-encoded so you get the right operation every time.
Choose Your Options and Click Convert
Toggle URL-Safe Mode to produce tokens safe for use in JWTs and query strings. Enable Wrap at 76 chars for MIME-compliant email encoding. Then click Encode to Base64 or Decode from Base64 — results are instant.
Copy, Download, or Swap
Copy your result to the clipboard in one click, download it as a .txt file, or click Swap to move the output back into the input and continue processing. For file uploads, copy the complete data: URI for direct HTML/CSS embedding. All operations are saved to the History tab.
PREMIUM FEATURES
The Most Complete Free Base64 Tool
Packed with professional features built for developers, security engineers, and power users
Instant Real-Time Encoding
Results are generated immediately on button click. No page reloads, no server round-trips — everything runs inside your browser using native JavaScript Web APIs for maximum speed.
URL-Safe Base64 (RFC 4648)
Switch to URL-Safe mode to replace + and / with - and _. Essential for JWT tokens, OAuth authorization codes, PKCE verifiers, and any Base64 used in URLs.
File & Image Encoder
Drag and drop any file — PNG, JPG, GIF, WebP, PDF, MP3, MP4 — to convert it to Base64 instantly. Get the full data: URI for embedding images directly into HTML, CSS, or JavaScript.
Smart Auto-Detect Mode
Not sure if your input is plain text or Base64? Enable Auto-detect and the tool automatically identifies the format, preventing you from accidentally encoding already-encoded data.
MIME Line Wrapping
Wrap encoded output at 76 characters per line to comply with the MIME standard (RFC 2045). Required for Base64 content in email messages, multipart HTTP requests, and some legacy systems.
Swap Input / Output
One click sends your output back into the input field for round-trip testing. Verify that encoding followed by decoding returns exactly your original string — critical for debugging data pipelines.
URL Percent-Encoder
A dedicated URL Encode / Decode tab lets you percent-encode special characters for safe use in query strings, path parameters, and HTTP request bodies — encodeURIComponent precision.
Conversion History
Your 20 most recent conversions are automatically saved in the History tab. Click any entry to reload the input, making it easy to compare results or re-process previous strings.
Size & Ratio Statistics
See your input length, output length, and the size ratio in real time — so you always know exactly how much overhead the Base64 encoding is adding to your data payload.
100% Private & Secure
All processing happens entirely inside your browser using btoa(), atob(), and the FileReader API. Zero data is ever transmitted to any server. Works completely offline.
One-Click Copy & Download
Copy results to clipboard instantly or download as a .txt file. For file uploads, copy the raw Base64 or the complete data: URI with a single button click.
Fully Responsive Design
Works flawlessly on desktop, tablet, and mobile. Encode and decode from any device, any browser, anywhere — completely free with no installation or account required.
LEARN
What Is Base64 Encoding?
A complete guide — how it works, why it exists, standard variants, and when to use it
📖 Definition
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. The name derives from that character set: the 26 uppercase letters (A–Z), 26 lowercase letters (a–z), the digits 0–9, plus + and /, with = used as padding.
It was developed to enable binary data — such as images, executable files, and arbitrary byte sequences — to be safely transmitted over systems built only for plain text, like early email infrastructure (SMTP) and HTTP headers.
⚙️ How It Works
Base64 groups input bytes into chunks of 3 (24 bits). Each chunk is split into four 6-bit values, and each 6-bit value maps to one of 64 characters. This means 3 bytes → 4 characters, producing approximately a 33% increase in size.
When input length isn't divisible by 3, = padding fills the remainder: one leftover byte produces two Base64 chars plus ==; two leftover bytes produce three chars plus =.
"Ma" → [77, 97] → TWE=
"M" → [77] → TQ==
🔗 Standard vs URL-Safe Base64
Standard Base64 uses + and /, which are reserved characters in URLs. URL-Safe Base64 (RFC 4648 §5) replaces them with - and _, making the output safe in URLs, HTTP headers, cookies, and JSON without percent-encoding.
JWT (JSON Web Tokens), OAuth 2.0 PKCE code challenges, and many modern web APIs exclusively use URL-Safe Base64. Some implementations also omit the = padding. Toggle URL-Safe Mode in our tool to switch between both variants.
📧 MIME Base64 & Line Wrapping
MIME (RFC 2045) specifies that Base64 content in email messages must be wrapped at exactly 76 characters per line, with each line ending in CRLF (\r\n). This ensures compatibility with older mail transfer agents that have line-length limits. Our "Wrap at 76 chars" option produces RFC 2045-compliant output automatically. For use in JSON, HTML, or CSS, always leave wrapping disabled.
USE CASES
When Do You Need Base64?
Base64 is used across dozens of real-world scenarios in web development, APIs, security, and data transport
🖼️ Embedding Images in HTML & CSS
Convert images to data: URIs to embed them directly in HTML or CSS, eliminating extra HTTP requests. Ideal for small icons, loading spinners, and SVG logos bundled inside stylesheets.
🔐 JWT & Authentication Tokens
JSON Web Tokens use URL-Safe Base64 for their header and payload. Decode JWT tokens to inspect user claims, expiry, roles, and custom fields without needing the signing secret.
📧 Email Attachments (MIME)
SMTP email systems encode binary attachments — PDFs, images, spreadsheets — as Base64 so they can pass safely through text-only mail servers. MIME encoding requires 76-char line wrapping.
🌐 REST API Binary Payloads
JSON only supports text. Encode binary files as Base64 before including them in JSON request or response bodies — common in document management APIs, image upload endpoints, and webhook payloads.
🔑 Storing Credentials & Secrets
Store TLS certificates, SSH private keys, and binary API secrets as Base64 strings in environment variables, .env files, and CI/CD pipeline secret stores without corruption.
🛡️ HTTP Basic Auth Headers
HTTP Basic Authentication encodes username:password as Base64 in the Authorization header. Use our tool to quickly generate credentials for curl, Postman, or API testing scripts.
☁️ Kubernetes & Cloud Secrets
Kubernetes Secret resources store all values as Base64-encoded strings. Quickly encode secrets for YAML manifests or decode existing secret values retrieved via kubectl get secret.
🧪 Security Testing & CTFs
Security researchers and CTF players frequently encounter Base64-encoded payloads in cookies, headers, and responses. Decode them instantly to find hidden data, credentials, or obfuscated code.
📄 XML & SOAP Web Services
Legacy SOAP and XML-based web services often transport binary attachments — PDFs, images, signed documents — as Base64-encoded strings within XML element text nodes.
COMPARISON
Base64 vs Other Encoding Schemes
Know when to use Base64 and when a different encoding is the better choice
| Encoding | Size Overhead | URL Safe | Binary Safe | Best For |
|---|---|---|---|---|
| Base64 (Standard) | ~33% | ✗ | ✓ | Email, HTML, REST APIs |
| Base64 URL-Safe | ~33% | ✓ | ✓ | JWT, OAuth, URLs |
| Hexadecimal | ~100% | ✓ | ✓ | Hashes, checksums |
| URL Encoding (%XX) | Varies | ✓ | ✗ | Query strings, forms |
| Plain ASCII | 0% | Partial | ✗ | Human-readable text only |
FOR EVERYONE
Who Uses This Tool?
From beginners to senior engineers — our Base64 tool is built for every skill level
Web Developers
Embed fonts and images in CSS, generate data: URIs, encode API payloads, debug JWT tokens, and test HTTP Basic Auth credentials during development.
Security Researchers
Decode Base64-encoded payloads in cookies, HTTP headers, JWT tokens, and web app responses during penetration tests, code reviews, and bug bounty hunting.
DevOps & SRE Engineers
Encode TLS certificates, SSH keys, and API tokens for Kubernetes Secrets, Terraform configs, GitHub Actions secrets, and Helm chart values.
Email Developers
Test MIME Base64 encoding for HTML email attachments and inline images. Verify RFC 2045 line wrapping without needing to set up a full mail server.
Students & Learners
Experiment in real time to understand how Base64 works — see padding, character mapping, and size overhead live as you type different inputs.
Data Scientists
Encode model artifacts, binary datasets, and image arrays for transport in REST APIs, message queues, or storage in text-only databases and JSON config files.
FAQ
Frequently Asked Questions
Everything you need to know about Base64 encoding, decoding, and this free online tool
Start Encoding & Decoding Base64 Now
Free, instant, private, and packed with premium features. No account, no limits — just paste and go.