Base64 Encoder & Decoder
Encode any text or JSON into Base64, or decode Base64 back to readable text. Use the swap button to change direction.
Text / JSON → Base64
🔒 Everything happens inside your browser. Your data is never uploaded or stored.
What is Base64?
Worked Example
Here is an example showing how standard text converts into Base64 and back:
Hello World!SGVsbG8gV29ybGQhEach group of 3 raw bytes (24 bits) maps to 4 Base64 characters (6 bits each). Clicking "Swap direction" lets you paste SGVsbG8gV29ybGQh to immediately recover Hello World!.
Works with all languages and emojis
Is my data safe?
Technical Specification & Practical Use Cases
RFC 4648 Encoding Architecture & Bitwise Mechanics
Base64 is an established binary-to-text encoding standard formalised by the Internet Engineering Task Force in RFC 4648 ("The Base16, Base32, and Base64 Data Encodings"). It was engineered to transmit arbitrary binary data or special characters across network channels that were originally designed to handle strictly printable 7-bit US-ASCII characters.
At the bitwise level, the algorithm groups raw input bytes into 24-bit blocks (comprising three 8-bit octets: 3 × 8 = 24 bits). These 24 bits are subsequently partitioned into four contiguous 6-bit units (4 × 6 = 24 bits). Because a 6-bit unsigned integer can represent values from 0 to 63 (2⁶ = 64), each unit serves as a direct index into the standard Base64 character table: uppercase letters A–Z (indices 0–25), lowercase letters a–z (indices 26–51), numerals 0–9 (indices 52–61), plus + (index 62) and / (index 63). If the input byte length is not divisible by 3, equal sign (=) padding is appended. A single leftover byte produces two 6-bit symbols followed by == padding, while two leftover bytes yield three 6-bit symbols followed by =. This transformation causes an inherent 33.33% payload expansion.
Standard Base64 vs. URL-Safe Base64 (base64url)
Under standard RFC 4648 §4 Base64, the + and / characters introduce severe ambiguity when embedded in HTTP query strings, path segments, and HTTP headers, because + frequently decodes as a space character and / denotes directory boundaries. To resolve this without URL-encoding penalties, RFC 4648 §5 defines URL-Safe Base64 (base64url), substituting - (hyphen) for + and _ (underscore) for /, while frequently omitting trailing padding characters. This safe dialect powers modern web identity infrastructure, including JSON Web Tokens (JWT header, payload, and HMAC/RSA digital signatures), WebAuthn authentication tokens, and OAuth 2.0 PKCE challenge parameters.
Browser Memory & Modern Unicode Handling
Legacy browser implementations relied on window.btoa() and window.atob(), but these native functions crash with an InvalidCharacterError when processing any character outside the basic Latin-1 range (code points greater than 0x00FF). Modern client-side tools avoid this by streaming text through the WHATWG TextEncoder and TextDecoder APIs, transforming strings into continuous UTF-8 Uint8Array buffers before converting to Base64. This guarantees that international scripts, accents, and multi-byte UTF-16 surrogate pairs (such as emojis) encode and decode losslessly.
Practical Real-World Use Cases
- Data URIs in Web Performance: Inlining critical above-the-fold SVG icons or micro-thumbnails directly into CSS and HTML using
data:image/svg+xml;base64,...eliminates TCP handshakes and eliminates render-blocking network round-trips. - HTTP Authorization Headers: Packaging client credentials formatted as
username:passwordinto HTTPAuthorization: Basic <base64>headers across REST and GraphQL APIs. - MIME Protocol Attachments: Encapsulating binary PDF documents, digital certificates, and audio files into 7-bit ASCII payloads for email transfer under RFC 2045.
Frequently Asked Questions
What is Base64 encoding used for?
Base64 is commonly used to transmit binary data or text containing special characters through systems designed for plain ASCII text, such as HTTP authorization headers, email attachments (MIME), data URLs, and configuration files.
Is Base64 an encryption algorithm?
No. Base64 is a public, two-way encoding scheme, not encryption. It does not provide security or confidentiality, as anyone can decode a Base64 string back to its original plain text without a cryptographic key.
Does this tool support non-English characters and emojis?
Yes. Our converter uses full UTF-8 byte serialization, ensuring accented characters, international alphabets, and emojis encode and decode reliably without corrupted symbols.
Is my data private when using this converter?
Yes. The encoding and decoding processes execute entirely in your web browser. Nothing you paste or convert is transmitted over the internet or saved to our servers.
Related Tools
Convert structured JSON lists to spreadsheet-ready CSV and back.
Convert between JSON and YAML configuration formats.
Make text safe for web addresses or decode %20-style URLs.
Generate TypeScript interfaces and types from JSON objects.
Analyze your text for word counts and frequency density.