Base62 to Base64 Converter
Convert between Base62 and Base64 encodings instantly. Bi-directional converter with validation, copy, download, and conversion history.
About
Base62 encoding maps binary data onto the 62-character alphabet 0-9, A - Z, a - z. It avoids URL-unsafe characters (+, /, =) present in standard Base64 (RFC 4648), making it common in short URL services, database keys, and token generation. Base64 uses 64 symbols and is the dominant encoding for embedding binary payloads in JSON, email (MIME), and data URIs. Converting between them requires decoding the source into its raw byte representation, then re-encoding into the target alphabet. A single misidentified character will corrupt the entire output because both schemes treat input as a positional numeral in their respective radix.
This tool performs exact, lossless conversion using arbitrary-precision integer arithmetic (BigInt). It does not approximate or truncate. Note: Base62 has no canonical padding scheme, so leading zero-bytes in the original data may not round-trip identically unless a length prefix is used. If your Base62 variant uses a non-standard alphabet order, verify the mapping before relying on the output in production systems.
Formulas
Both Base62 and Base64 are positional numeral systems. A string S of length n in base b represents an integer N:
Where Si is the numeric value of the i-th character in the alphabet. The conversion pipeline is:
To extract bytes from N, repeatedly divide by 256 and collect remainders (big-endian):
The bits-per-character efficiency is log2(b). For Base62: log2(62) ≈ 5.954 bits/char. For Base64: exactly 6 bits/char.
Where: N = decoded integer value, b = radix (62 or 64), Si = ordinal of character at position i, n = string length.
Reference Data
| Property | Base62 | Base64 (RFC 4648) |
|---|---|---|
| Alphabet Size | 62 | 64 |
| Characters Used | 0-9 A - Z a - z | A - Z a - z 0-9 + / |
| Padding Character | None | = |
| URL Safe | Yes | No (requires URL-encoding or Base64url variant) |
| Space Efficiency (bits/char) | 5.954 (log262) | 6.000 (log264) |
| Expansion Ratio (vs raw bytes) | ≈ 1.344× | ≈ 1.333× |
| Common Uses | Short URLs, UUIDs, tokens | MIME email, data URIs, JWTs |
| Case Sensitive | Yes | Yes |
| Sorting Preserves Order | Yes (lexicographic = numeric) | No (alphabet order differs) |
| Regex Validation | /^[0-9A-Za-z]+$/ | /^[A-Za-z0-9+/]+={0,2}$/ |
| Null Byte Handling | Leading zeros lost without prefix | Preserved (3-byte grouping) |
| RFC / Standard | No formal RFC | RFC 4648 |
| Base64url Variant | N/A | Replaces + → -, / → _ |
| Encoding 128-bit UUID | 22 chars | 24 chars (with padding) |
| Encoding 256-bit hash | 43 chars | 44 chars (with padding) |
| JavaScript Native Support | Manual implementation required | btoa() / atob() |