Any Number to Any Base Converter
Convert numbers between any bases from 2 to 64. Supports binary, octal, decimal, hex, base-36, base-64 and arbitrary radix conversion.
About
Incorrect base conversion is a silent source of data corruption in cryptographic hashing, memory addressing, and network protocol design. A single misinterpreted hexadecimal nibble in a MAC address or a mis-mapped base-64 index in a JWT token invalidates the entire payload. This tool converts any integer or fractional number between radices 2 through 64 using arbitrary-precision arithmetic via BigInt, eliminating the IEEE-754 floating-point truncation that plagues naive implementations. The digit alphabet follows the convention 0 - 9, A - Z, a - z, +, / - consistent with Base64 (RFC 4648) for bases above 62.
Fractional parts are approximated via repeated multiplication to a configurable precision of up to 32 digits. Note: most fractional values cannot be represented exactly in a different base (e.g., 0.1 in base 10 is repeating in base 2). The tool truncates, not rounds, fractional output. Negative numbers are handled by preserving the sign prefix. For bases above 36, digits become case-sensitive.
Formulas
The integer part of a number N expressed in base b with digits dk is evaluated as:
Conversion from base b1 to base b2 proceeds in two stages. First, Hornerβs method accumulates the source digits into a decimal (base-10) BigInt:
Second, repeated division by b2 extracts target digits from least-significant to most-significant:
For fractional parts, repeated multiplication extracts digits from most-significant to least-significant: multiply the fractional remainder by b2, take the integer part as the next digit, and repeat up to the configured precision p.
Where: N = numeric value, b = base (radix), dk = digit at position k, n = number of digits minus one, p = fractional precision (max 32).
Reference Data
| Base | Name | Digits Used | Common Use |
|---|---|---|---|
| 2 | Binary | 0 - 1 | CPU logic, bitfields, networking masks |
| 3 | Ternary | 0 - 2 | Balanced ternary computing, Soviet Setun computer |
| 5 | Quinary | 0 - 4 | Tally counting systems, some historical numeral systems |
| 8 | Octal | 0 - 7 | Unix file permissions (chmod), PDP-11 architecture |
| 10 | Decimal | 0 - 9 | Human-readable numbers, financial calculations |
| 12 | Duodecimal | 0 - B | Timekeeping (12 hours), imperial measurements (12 inches) |
| 16 | Hexadecimal | 0 - F | Memory addresses, CSS colors, MAC addresses, SHA hashes |
| 20 | Vigesimal | 0 - J | Maya numeral system, French counting (quatre-vingts) |
| 32 | Duotrigesimal | 0 - V | Crockford Base32 encoding, z-base-32, Geohash |
| 36 | Hexatrigesimal | 0 - Z | Case-insensitive compact encoding, Reddit post IDs |
| 58 | Base58 | Alphanumeric minus 0OIl | Bitcoin addresses, IPFS hashes (ambiguity-free) |
| 60 | Sexagesimal | 0 - x | Babylonian math, time (60 seconds), angle degrees |
| 62 | Base62 | 0 - z | URL shorteners (bit.ly), YouTube video IDs |
| 64 | Base64 | 0 - z, +, / | MIME encoding, data URIs, JWT tokens (RFC 4648) |