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?

Base64 is a way of writing data using only letters, numbers, + and /. It is often used to pass data through systems that only accept plain text, such as emails, web addresses and some API headers. It is encoding, not encryption, so anyone can decode it.

Worked Example

Here is an example showing how standard text converts into Base64 and back:

Plain Text Input:Hello World!
Base64 Output:SGVsbG8gV29ybGQh

Each 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

This tool uses UTF-8, so accented letters, non-English text and emojis encode and decode correctly. When decoding, it also accepts URL-safe Base64 (with - and _) and Base64 that is missing its trailing = signs.

Is my data safe?

Yes. Encoding and decoding happen in your browser and nothing is uploaded. If the input is not valid Base64, or it decodes to a file rather than text, the tool tells you in plain words.

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:password into HTTP Authorization: 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