Base64 Encoder Decoder
Free, 100% client-side Base64 encoder and decoder. Convert text, strings, and data to Base64 or Base64URL instantly with UTF-8 support, padding controls, and client-side processing.
Input Editor
Plain Text / FileOutput Result
Base64 StringOverview
The ToolMono Base64 Encoder & Decoder is an enterprise-grade, privacy-first web developer utility designed for software engineers, backend developers, frontend architects, security researchers, and DevOps specialists. Base64 encoding is an open RFC 4648 specification created to represent arbitrary binary data or multi-byte unicode strings in a universally compatible ASCII text format.
Many legacy network protocols—such as 7-bit SMTP email transmission, HTTP header values, URL query parameters, and JSON payloads—cannot safely transmit raw binary bytes or unescaped control characters without data corruption. By translating 8-bit binary sequences into 6-bit index offsets mapped to 64 printable ASCII characters, Base64 ensures flawless data transmission across all network boundaries.
Unlike online converters that transmit sensitive payloads, API tokens, or internal images to remote backend logging servers, ToolMono executes 100% client-side Base64 processing using native browser Web APIs (TextEncoder, TextDecoder, FileReader). Your text, files, and images never leave your machine sandbox. For complementary developer workflows, explore our URL Encoder & Decoder, JWT Decoder, JSON Formatter, and Hash Generator.
Base64 Encoding & Decoding Engine
ToolMono features a modern, bi-directional Base64 engine built for extreme performance, compliance, and developer convenience. The engine handles text and file conversions with zero server lag:
Intelligently inspects input text to automatically distinguish between raw plain text (to encode) and Base64/Data URI strings (to decode).
Full support for UTF-8 (emojis and global unicode characters), UTF-16, 7-bit ASCII, and Latin-1 (ISO-8859-1) character sets.
Instantly converts standard Base64 characters (+ and /) into URL-Safe characters (- and _).
Automatically validates padding alignment and repairs missing = trailing characters for malformed inputs.
File Support & Drag-and-Drop
Universal File & Binary Payload Converter
Base64 is not limited to plain text strings. ToolMono allows you to drag & drop any document or binary asset directly into your browser. The engine converts the file into raw Base64 or formatted Data URIs instantly:
Image Preview & Data URI Generation
Automatic Data URI & Image Inspection
When decoding Base64 strings or pasting data:image/... payloads, ToolMono automatically inspects the magic byte headers to render a live image preview alongside key image metadata:
- Live Image Canvas Render
- Dimensions (Width x Height in pixels)
- Calculated File Size (KB/MB)
- Detected MIME Type (image/png, image/jpeg, image/webp, image/svg+xml)
- One-click Image File Download
HTML & CSS Inline Embedding Syntax
Embedding small Base64 images directly into HTML or CSS eliminates additional HTTP network requests for icons and badges:
<!-- HTML Inline Image -->
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." alt="Logo" />
/* CSS Background Image */
.button-icon {
background-image: url('data:image/svg+xml;base64,PHN2Zz4...');
}Advanced Options & Configuration
| Option | Setting Values | Specification & Use Case |
|---|---|---|
| Base64 Format | Standard (+) / URL Safe (-_) | Replaces + and / with - and _ to prevent URL query parameter corruption. |
| Character Set | UTF-8 | UTF-16 | ASCII | Latin-1 | Controls byte serialization for non-ASCII characters, emojis, and legacy systems. |
| Padding Behavior | Auto Repair | Remove | Restore | Manages trailing = padding characters required by RFC 4648 alignment rules. |
| Line Wrapping | None | 64 chars | 76 chars | Custom | Wraps Base64 output into lines. 64 chars for MIME email, 76 chars for PEM keys. |
Validation Statistics & RFC 4648 Compliance
Compliance Status
Monitors invalid characters, unaligned string lengths, and illegal whitespace to verify RFC compliance.
Character & Byte Counters
Calculates precise input character count, input byte size, output character count, and output byte size.
Expansion Ratio
Displays exact payload overhead ratio (+33.3% for encoding, -25.0% for decoding).
Developer Code Examples (11 Languages)
Select your target programming language to view production-ready Base64 encoding and decoding snippets:
// JavaScript (Browser) - Text & Data URI Base64 Encoding/Decoding
// 1. Encode UTF-8 Text to Base64 (Standard RFC 4648)
function encodeBase64(text) {
const bytes = new TextEncoder().encode(text);
let binary = "";
for (let i = 0; i < bytes.byteLength; i++) {
binary += String.fromCharCode(bytes[i]);
}
return btoa(binary);
}
// 2. Decode Base64 string to UTF-8 Text
function decodeBase64(b64) {
// Strip whitespace and fix missing padding
let clean = b64.trim().replace(/[\r\n\s]/g, "");
while (clean.length % 4 !== 0) clean += "=";
const binary = atob(clean);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) {
bytes[i] = binary.charCodeAt(i);
}
return new TextDecoder("utf-8").decode(bytes);
}
// 3. Convert Standard Base64 to URL-Safe Base64
function toUrlSafeBase64(b64) {
return b64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
}
// Usage Example
const encoded = encodeBase64("Hello ToolMono 🚀 Base64");
console.log("Encoded:", encoded); // "SGVsbG8gVG9vbE1vbm8g8J+agCBCYXNlNjQ="
console.log("Decoded:", decodeBase64(encoded));RFC 4648 Reference Tables
1. Base64 Index Character Map (Values 0–63)
| Val | Char | Val | Char | Val | Char | Val | Char |
|---|---|---|---|---|---|---|---|
| 0–25 | A–Z | 26–51 | a–z | 52–61 | 0–9 | 62 | + (std) / - (url) |
| 63 | / (std) / _ (url) | Pad | = (equals) | Bits | 6 bits/char | Overhead | +33.33% |
2. Byte Alignment & Padding Examples
| Input Text | Input Bytes | Binary (24-bit Groups) | Base64 Output | Padding Status |
|---|---|---|---|---|
| "Man" | 3 bytes | 01001101 01100001 01101110 | TWFu | No Padding Needed |
| "Ma" | 2 bytes | 01001101 01100001 (000000) | TWE= | 1 Equals Pad (=) |
| "M" | 1 byte | 01001101 (0000000000) | TQ== | 2 Equals Pad (==) |
What is Base64 & How Does It Work?
Computers store data in 8-bit bytes (values from 0 to 255). However, traditional networking protocols (such as HTTP query strings, SMTP emails, and XML documents) were originally designed to handle only printable 7-bit ASCII text. Attempting to transmit raw binary bytes (like images or encrypted payloads) over these protocols often resulted in byte truncation or corruption. Base64 solves this by converting 3 binary bytes (24 bits) into 4 printable ASCII characters (6 bits per character).
MIME & Email Attachments
In 1992, the IETF published MIME (Multipurpose Internet Mail Extensions) RFC 2045. Base64 is used to encode binary email attachments (PDFs, images, archives) so they can travel safely across legacy 7-bit SMTP mail servers.
HTTP Basic Authentication
HTTP Basic Auth headers send client credentials formatted as username:password encoded in Base64 within the Authorization: Basic <base64> header. Always use HTTPS to protect this header in transit.
AI Overview Answers
What is Base64?
Base64 is a binary-to-text encoding standard defined by RFC 4648. It translates binary bytes or text into an ASCII string composed of 64 printable characters (A-Z, a-z, 0-9, +, / or -, _).
Is Base64 encryption?
No. Base64 is not encryption. Base64 provides zero security or confidentiality. Anyone can instantly decode a Base64 string back into original text or binary data without a secret key.
What is URL Safe Base64?
URL Safe Base64 replaces the + and / characters with - (hyphen) and _ (underscore) to prevent URL routing and query parameter syntax errors.
Why does Base64 increase file size?
Base64 represents 3 bytes (24 bits) of data using 4 ASCII characters (6 bits per character). This 4-to-3 ratio results in a consistent ~33.3% increase in file size.
How to Use ToolMono Base64
Select Mode
Choose Encode, Decode, or Auto-Detect mode.
Input Data
Type text or drop files (PNG, PDF, SVG, JSON).
Configure Options
Toggle URL Safe (-_), UTF-8/ASCII, or padding repair.
Instant Processing
View live image previews and RFC stats.
Copy / Download
Copy output, download TXT/JSON, or save binary image.
Base64 Best Practices
Use URL Safe Base64 for Web Query Parameters
Always use URL Safe Base64 (- and _) when embedding tokens or parameters in URLs to prevent web server decoding errors.
Limit Data URI Inline Embedding to Small Files (<10KB)
Only embed small icons or SVGs as Data URIs. Base64 encoding large images increases bundle sizes and defeats HTTP caching benefits.
Common Errors & Fixes
Invalid Character in Base64 String
The input string contains non-base64 characters or unescaped line breaks. Enable Auto Padding Repair or strict sanitize mode.
Garbled Decoded Output
The Base64 string decodes to binary data (like an image or PDF) rather than plain text. Check the Image Preview card or click 'Download Binary'.
Tips & Tricks
Direct Clipboard Image Pasting
Copy any image screenshot to your system clipboard and press Ctrl+V inside the input editor to convert it to a Data URI instantly.
Local Storage Workspace History
Your recent Base64 conversions are automatically saved in your browser's private local storage for instant access across browser sessions.
Frequently Asked Questions
Privacy & E-E-A-T Verification
100% Client-Side Privacy & Testing Methodology
ToolMono adheres to rigorous web security standards. Every Base64 conversion, byte calculation, padding validation, and image rendering executes exclusively inside your local browser runtime. No text strings, secret keys, uploaded files, or generated Data URIs are transmitted over HTTP connections or stored on remote servers.
- Tested against RFC 4648 & RFC 2045 Specs
- Zero External Network Requests
- Supports Native Browser Web Crypto & Encoding APIs
- 100% Offline Capable
References & Standards
RFC 4648: The Base16, Base32, and Base64 Data Encodings
Official IETF standard specification for Base64 and URL-safe Base64 alphabets.
MDN Web Docs: Base64 Encodings Specification
Official Mozilla guide to binary-to-text encoding and browser APIs.
WHATWG HTML Standard: btoa() & atob() Methods
WHATWG recommendation for client-side Base64 conversion.
Related Tools
Browse all toolsJWT Decoder Online
Decode JWT tokens instantly in your browser. Inspect headers, payload claims, verify signatures, convert timestamps, and debug JWTs securely with 100% client-side processing.
URL Encoder & Decoder
Free, 100% client-side URL encoder and decoder. Convert text and query parameters into RFC 3986 percent-encoded strings or decode URLs with smart double-encoding detection and structural URL analysis.
JSON Formatter
Free online JSON formatter, beautifier, and validator. Format, indent, minify, and inspect JSON with real-time syntax error detection in your browser. 100% client-side.
Hash Generator
Generate hashes and file checksums locally in your browser. Compare digests, copy results, and use MD5, SHA-1, SHA-2, SHA-3, BLAKE2, and supported HMAC algorithms.
Online JWT Generator & Token Signer
Build and sign JSON Web Tokens online for API testing and development. Customize JWT claims and generate signed tokens directly in your browser with 100% client-side processing.
Text Compare
Compare two texts online and find differences instantly. Highlight changes line-by-line, word-by-word, or character-by-character with a fast browser-based diff checker.
Regex Tester
Test JavaScript regular expressions with live match highlighting, capture-group inspection, flags, and replacement preview. 100% client-side privacy.