|
Developer Utilities 100% Client-Side · 0 Bytes Sent to Server Instant In-Memory Execution

Base64 Encoder & Decoder

Fast, privacy-focused Base64 encoding and decoding tool. Encode string inputs to UTF-8 Base64 strings or decode Base64 outputs effortlessly.

Output Format:
0 / 2,000,000 chars

Step-by-Step Instructions

1

Input Text, Hex, or File

Paste plain UTF-8 text, hexadecimal data, or upload an image/binary file.

2

Select Mode (Encode or Decode)

Choose Base64 Encode to generate ASCII Base64 strings, or Base64 Decode to restore original text or binary.

3

Configure Encoding Format

Select Standard Base64 (RFC 4648) or URL-Safe Base64 (replacing `+` and `/` with `-` and `_`).

4

Copy or Download Converted Output

Copy converted Base64 text or download decoded binary files directly.

Key Features & Capabilities

  • RFC 4648 standard Base64 encoding and decoding with full UTF-8 / Unicode character support
  • URL-Safe Base64 variant support (`-` and `_` with optional padding stripping) for JWTs and URL parameters
  • Base64 Data URI generator for embedding images, SVG, fonts, and CSS directly into HTML
  • Binary file to Base64 and Base64 to binary file download support

Frequently Asked Questions

How does Base64 encoding work mathematically?

Base64 encoding takes binary data and splits it into 6-bit chunks (since $2^6 = 64$). Each 6-bit value (0 to 63) maps to an ASCII character in the standard 64-character alphabet: `A–Z` (0–25), `a–z` (26–51), `0–9` (52–61), `+` (62), and `/` (63). Three 8-bit bytes (24 bits total) are converted into four 6-bit Base64 characters, with `=` used as padding.

Why does Base64 encoding increase data size by 33%?

Because Base64 represents 3 binary bytes (24 bits) using 4 ASCII characters (32 bits), data size increases by exactly **33.33%** ($4/3 = 1.333$). Adding MIME line breaks and padding increases total overhead to approximately **37%**.

What is URL-Safe Base64 (Base64URL) and where is it used?

Standard Base64 contains `+`, `/`, and `=` characters, which have special reserved meanings in URLs and query strings. **URL-Safe Base64 (RFC 4648 §5)** replaces `+` with hyphen (`-`), replaces `/` with underscore (`_`), and omits trailing `=` padding, making it safe for JSON Web Tokens (JWT) and URL paths.

What is a Base64 Data URI in web development?

A Data URI allows small media assets (images, icons, fonts) to be embedded inline in HTML/CSS without making extra HTTP requests: `data:image/png;base64,iVBORw0KGgo...`. This reduces HTTP roundtrips for tiny SVGs and icons.

Discover complementary online tools in the same workflow.