Base64 Decode String
Decode Base64 encoded strings to plain text, hex, or binary output. Supports UTF-8, ASCII, and URL-safe Base64 variants instantly.
About
Base64 encoding inflates data by approximately 33% because it maps every 3 input bytes to 4 ASCII characters drawn from a 64-character alphabet. Decoding reverses this: each group of 4 encoded characters reconstructs 3 original bytes. A single corrupted character or misplaced padding (=) produces a complete decode failure, not partial garbage. This tool validates the input character set before attempting the decode, reports the exact position of illegal characters, and handles both standard (RFC 4648 ยง4) and URL-safe (RFC 4648 ยง5) alphabets. Output modes include UTF-8 text, raw ASCII, hexadecimal byte dump, and binary representation.
Note: this decoder assumes the source data was encoded as a single contiguous Base64 string. MIME-style line breaks (every 76 characters) are stripped automatically. The tool approximates decoded size as 34 ร n, where n is the encoded length excluding padding. Pro tip: if you receive a Base64 string starting with ey, it is almost certainly a JSON Web Token (JWT) payload encoded without encryption.
Formulas
The decoded byte length from a Base64 string is computed as:
where n = total number of Base64 characters (excluding whitespace), and p = number of padding = characters (0, 1, or 2).
Each Base64 character encodes 6 bits. Four characters therefore encode 24 bits (3 bytes). The decode mapping for a single character c is:
The three output bytes from four indices (i0, i1, i2, i3) are reconstructed via bitwise operations:
byte1 = ((i1 & 0xF) << 4) | (i2 >> 2)
byte2 = ((i2 & 0x3) << 6) | i3
Reference Data
| Character Range | Index Range | Count | Description |
|---|---|---|---|
| A - Z | 0 - 25 | 26 | Uppercase Latin letters |
| a - z | 26 - 51 | 26 | Lowercase Latin letters |
| 0-9 | 52 - 61 | 10 | Decimal digits |
| + | 62 | 1 | Standard alphabet only |
| / | 63 | 1 | Standard alphabet only |
| - | 62 | 1 | URL-safe replacement for + |
| _ | 63 | 1 | URL-safe replacement for / |
| = | Padding | 0 - 2 | Pad to multiple of 4 |
| Common Base64 Prefixes | |||
| ey... | - | - | JSON object (JWT header/payload) |
| iVBOR... | - | - | PNG image file |
| /9j/... | - | - | JPEG image file |
| UEsDB... | - | - | ZIP / DOCX / XLSX archive |
| JVBER... | - | - | PDF document |
| R0lGO... | - | - | GIF image file |
| AAAA... | - | - | Binary data (null bytes) |
| PD94b... | - | - | XML document |
| SFRU... | - | - | HTTP response (starts with "HTT") |
| PHN2Z... | - | - | SVG image file |
| Size Ratios | |||
| Encoding overhead | 33.33% size increase (3 bytes โ 4 chars) | ||
| Decoding ratio | 75% of encoded size (4 chars โ 3 bytes) | ||
| Bits per character | 6 bits (log264) | ||
| Max line length (MIME) | 76 characters (RFC 2045) | ||
| Max line length (PEM) | 64 characters (RFC 7468) | ||