Base64 Decoder
Decode Standard (RFC 4648), URL-Safe, MIME, and Data URI Base64 strings into UTF-8 text, hexadecimal byte dumps, or downloadable binary files. Inspect 6-bit quartet to 8-bit byte transformations and detect invalid Base64 characters in real time.
Live Base64 Quartet-to-Byte Bit Inspector (First 4 Characters → 3 Bytes)
Base64 decoding converts each 4-character quartet (4 × 6 bits = 24 bits) into up to 3 raw 8-bit bytes. Below is the live bit-level breakdown of the first quartet from your current input (eyJ0):
| Stage | Slot 1 | Slot 2 | Slot 3 | Slot 4 |
|---|---|---|---|---|
| 1. Base64 Character | e (Index 30) |
y (Index 50) |
J (Index 9) |
0 (Index 52) |
| 2. 6-Bit Sextet | 011110 |
110010 |
001001 |
110100 |
| 3. Regrouped 8-Bit Bytes | 01111011 (0x7B = 123) |
00100010 (0x22 = 34) |
01110100 (0x74 = 116) |
24 bits → 3 bytes |
| 4. Decoded ASCII / Byte | { |
" |
t |
Combined: {"t |
How Base64 Decoding Works (RFC 4648 Algorithm)
2. Combine into 24-bit integer: N = (s0 << 18) | (s1 << 12) | (s2 << 6) | s3
3. Extract three 8-bit bytes:
Byte 0 = (s0 << 2) | (s1 >> 4)
Byte 1 = ((s1 & 0x0F) << 4) | (s2 >> 2) [omitted if c2 is '=']
Byte 2 = ((s2 & 0x03) << 6) | s3 [omitted if c3 is '=']
Standard vs. URL-Safe Alphabet: Standard Base64 (RFC 4648 §4) uses + for index 62 and / for index 63. URL-Safe Base64 (RFC 4648 §5, used in JWTs and URL parameters) replaces them with - (hyphen) and _ (underscore) and frequently omits trailing = padding.
Illustrative Base64 Decoding Examples
Example 1 — Padded Text String (Illustrative): Decode dXNlcjpwYXNzd29yZDEyMw== (an HTTP Basic Authentication payload):
- Quartet Count: 24 characters = 6 quartets, ending with two
=padding characters. - Byte Calculation: (6 × 3) − 2 = 16 bytes.
- Decoded UTF-8 String:
user:password123.
Example 2 — URL-Safe Base64 String (Illustrative): Decode aHR0cHM6Ly9leGFtcGxlLmNvbS8_cT0x:
- URL-Safe Detection: Contains
_at position 28 (index 63 in RFC 4648 §5, replacing/). - Decoded UTF-8 String:
https://example.com/?q=1(24 bytes).
How to Use the Base64 Decoder
- Paste or Load Base64 Input: Paste your encoded string into the left input box, click one of the sample chips, or click Load .txt / .b64 File to read a file from your computer.
- Choose Alphabet & Encoding Options: Leave Auto-Detect enabled to handle Standard (
+ /), URL-Safe (- _), anddata:...;base64,strings automatically, or enforce strict RFC 4648 rules. - Inspect Text, Hex, or Binary: Switch between Decoded Text, Hex & ASCII Dump, and 8-Bit Binary tabs to examine the decoded bytes.
- Copy, Download, or Re-Encode: Click Copy Output to copy the active view, Download File to save the raw decoded bytes, or edit the decoded text and click Re-Encode Text ↑ to encode it back into Base64.
Frequently Asked Questions
JavaScript's built-in atob() treats every decoded byte as a single-byte Latin-1 character, which corrupts multi-byte UTF-8 sequences (such as accented letters, CJK characters, or emojis) into mojibake. This decoder converts Base64 directly into a Uint8Array byte buffer and decodes it with a UTF-8 TextDecoder.
Each Base64 character carries 6 bits of data. A single trailing Base64 character provides only 6 bits, which is not enough to form a single 8-bit byte. Valid unpadded Base64 strings can only have lengths with a remainder of 0, 2 (12 bits → 1 byte), or 3 (18 bits → 2 bytes) when divided by 4.
A JWT consists of three dot-separated URL-Safe Base64 parts (header.payload.signature). Copy either the header or payload segment into the input box; with Auto-Detect and Auto-repair missing '=' padding checked, the JSON claims decode immediately.
No. All decoding, validation, hex formatting, and file downloads execute locally inside your browser using client-side JavaScript.