Base62 Decode String
Decode Base62-encoded strings back to original text, hex, or raw bytes. Supports arbitrary-length input with BigInt precision.
About
Base62 encoding maps binary data onto a 62-character alphabet: 0-9, A - Z, a - z. It produces URL-safe, filename-safe output without special characters - unlike Base64, which emits +, /, and =. This tool reverses the encoding: it takes a Base62 string and recovers the original byte sequence. Incorrect decoding silently corrupts data. A single invalid character in the input invalidates the entire output because Base62 is a positional numeral system in base 62, and every digit affects every byte of the result.
The decoder uses arbitrary-precision arithmetic (BigInt) internally, so it handles inputs of any practical length without overflow. Output can be rendered as UTF-8 text, ASCII, or hexadecimal bytes. Note: if the original data was not valid UTF-8, the text output may contain replacement characters (U+FFFD). Use hex mode to inspect raw bytes in that case.
Formulas
Base62 treats the input string as a number in base 62. Each character maps to a digit value d in the range [0, 61]. The decoded integer N is computed by Horner's method:
Iteratively this becomes the loop: N = N × 62 + di for each character left to right. The resulting integer N is then converted to a big-endian byte array by repeated division by 256:
The alphabet mapping is: digits 0-9 → values 0-9, uppercase A - Z → 10-35, lowercase a - z → 36-61. Information density is log2(62) ≈ 5.954 bits/char, compared to 6.0 bits/char for Base64.
Where N = decoded integer, di = digit value of the i-th character, n = length of the encoded string, and bytek = the k-th output byte (collected in reverse order).
Reference Data
| Encoding | Alphabet Size | Characters Used | URL Safe | Padding | Efficiency (bits/char) | Common Use |
|---|---|---|---|---|---|---|
| Base62 | 62 | 0-9 A - Z a - z | Yes | None | 5.95 | Short URLs, ID generation |
| Base64 | 64 | A - Z a - z 0-9 + / | No | = | 6.00 | Email (MIME), data URIs |
| Base64url | 64 | A - Z a - z 0-9 - _ | Yes | Optional | 6.00 | JWT, URL parameters |
| Base58 | 58 | 1-9 A - H J - N P - Z a - k m - z | Yes | None | 5.86 | Bitcoin addresses |
| Base36 | 36 | 0-9 a - z | Yes | None | 5.17 | Case-insensitive IDs |
| Base32 | 32 | A - Z 2-7 | Yes | = | 5.00 | TOTP secrets, Crockford IDs |
| Base16 (Hex) | 16 | 0-9 A - F | Yes | None | 4.00 | Color codes, checksums |
| Base85 (Ascii85) | 85 | ! - u | No | ~> | 6.41 | PDF, PostScript |
| Base91 | 91 | Printable ASCII subset | No | None | 6.51 | Compact binary-to-text |
| Base128 | 128 | Full 7-bit ASCII | No | None | 7.00 | Protobuf varints |
| Base256 | 256 | All byte values | No | None | 8.00 | Raw binary storage |
| Hexadecimal | 16 | 0-9 a - f | Yes | None | 4.00 | MAC addresses, hashes |
| Octal | 8 | 0-7 | Yes | None | 3.00 | Unix permissions |
| Binary | 2 | 0 1 | Yes | None | 1.00 | Bitwise debugging |