Base64 to JSON Converter
Decode Base64-encoded strings to JSON instantly. Validates, pretty-prints, and syntax-highlights output with download and copy support.
Decoded JSON will appear here...
About
Base64 encoding transforms binary or text data into a 64-character ASCII subset for safe transport across systems that corrupt raw bytes - email (MIME), URLs, JSON Web Tokens, and API payloads. The alphabet uses A - Z, a - z, 0 - 9, +, /, with = as padding. Each output character encodes 6 bits, so 3 input bytes become 4 Base64 characters - a fixed overhead of roughly 33%. Decoding a Base64 string that is supposed to contain JSON is a two-stage operation: first reverse the Base64 encoding to recover the raw UTF-8 byte stream, then parse those bytes as JSON according to RFC 8259. Failure at either stage means corrupted data or a broken integration.
This tool performs both stages with explicit error reporting. If the Base64 is malformed (wrong length, illegal characters), the decoder rejects it before JSON parsing begins. If decoding succeeds but the result is not valid JSON, the parser reports the exact character position of the syntax error. The tool assumes UTF-8 encoding, which covers all valid JSON per the specification. Note: this tool does not handle URL-safe Base64 (RFC 4648 ยง5) automatically - if your input uses - and _ instead of + and /, enable the URL-safe toggle before decoding.
Formulas
Base64 encoding maps every group of 3 input bytes (24 bits) onto 4 output characters (6 bits each). The encoded length is computed as:
where Linput = byte length of the original data and Lencoded = character count of the Base64 string (including padding). Decoding reverses this: each Base64 character is mapped to its 6-bit index via the alphabet lookup table, the bits are concatenated, and then split back into 8-bit bytes.
where P = number of padding characters (0, 1, or 2). For URL-safe Base64, the conversion step replaces - โ + and _ โ / before decoding, then re-applies padding if absent:
After decoding to a UTF-8 string, the result is fed to a strict JSON parser. A valid JSON document must begin with { or [ (or a scalar value per RFC 8259). The parser validates syntax including matched braces, correct comma placement, properly escaped strings, and number formats.
Reference Data
| Property | Standard Base64 (RFC 4648 ยง4) | URL-Safe Base64 (RFC 4648 ยง5) |
|---|---|---|
| Alphabet | A - Z, a - z, 0 - 9, +, / | A - Z, a - z, 0 - 9, -, _ |
| Padding character | = | = (often omitted) |
| Encoding ratio | 3 bytes โ 4 chars | 3 bytes โ 4 chars |
| Size overhead | ~33% | ~33% |
| Safe for URLs | FALSE | TRUE |
| Safe for filenames | FALSE | TRUE |
| Line breaks (MIME) | Every 76 chars | None |
| Use in JSON (RFC 8259) | String value only | String value only |
| Use in JWT (RFC 7519) | Not used | Header, Payload, Signature |
| Use in Data URIs | After base64, prefix | Not standard |
| Max input for atob() | Browser-dependent (~512MB) | Requires pre-conversion |
| Valid JSON types | object, array, string, number, TRUE, FALSE, NULL | |
| JSON max nesting (practical) | 512 levels (browser limit) | |
| JSON encoding | UTF-8 (mandatory per RFC 8259) | |
| Common error: trailing whitespace | Causes InvalidCharacterError | |
| Common error: BOM prefix | UTF-8 BOM (0xEF 0xBB 0xBF) breaks JSON.parse | |
| Common error: single quotes | Not valid JSON - only double quotes | |
| Bit group size | 6 bits per character | 6 bits per character |
| Padding logic | 0 remainder โ 0 pads, 1 remainder โ 2 pads, 2 remainder โ 1 pad | Same or omitted |