Base Number Converter
Convert numbers between any base from 2 to 64. Supports binary, octal, decimal, hex, base32, base64 with arbitrary precision.
About
Incorrect base conversion is a common source of off-by-one errors in protocol design, memory addressing, and cryptographic implementations. A single misinterpreted nibble in a hexadecimal MAC address or an IPv6 prefix renders the entire address invalid. This tool converts integer and fractional values between any radix from 2 (binary) to 64 (Base64 alphabet) using arbitrary-precision arithmetic via JavaScript BigInt internally. It does not truncate or round integer parts regardless of magnitude.
Fractional conversion uses the repeated-multiplication method, producing up to 32 fractional digits in the target base. Note: most fractional values that terminate in one base produce non-terminating expansions in another (e.g., 0.1 in base 10 is repeating in base 2). The tool truncates after 32 digits without rounding. For bases above 36, the extended alphabet uses lowercase letters followed by + and /, matching the RFC 4648 Base64 alphabet order.
Formulas
Integer conversion from base b1 to base b2 proceeds in two stages: decode then encode.
where di is the digit value at position i (rightmost = 0), and n is the digit count. This yields the internal integer N.
Remainders r collected in reverse order form the output digits.
For fractional parts, the repeated-multiplication algorithm applies:
Where b1 = source radix, b2 = target radix, N = decoded integer value, di = digit value at position i, r = remainder, f = fractional component.
Reference Data
| Base | Name | Digit Set | Common Use | Example (25510) |
|---|---|---|---|---|
| 2 | Binary | 0-1 | CPU registers, bitfields | 11111111 |
| 3 | Ternary | 0-2 | Balanced ternary logic | 100110 |
| 4 | Quaternary | 0-3 | DNA encoding (AโCโGโT) | 3333 |
| 5 | Quinary | 0-4 | Tally systems | 2010 |
| 6 | Senary | 0-5 | Dice probability | 1103 |
| 7 | Septenary | 0-6 | Week-day numbering | 513 |
| 8 | Octal | 0-7 | Unix file permissions (chmod) | 377 |
| 10 | Decimal | 0-9 | Human arithmetic | 255 |
| 12 | Duodecimal | 0-9, A - B | Timekeeping (12 hours, 12 months) | 193 |
| 16 | Hexadecimal | 0-9, A - F | Memory addresses, color codes | FF |
| 20 | Vigesimal | 0-9, A - J | Maya numeral system | CF |
| 32 | Base32 | 0-9, A - V | Crockford encoding, TOTP secrets | 7V |
| 36 | Base36 | 0-9, A - Z | URL shorteners, compact IDs | 73 |
| 58 | Base58 | Alphanumeric (no 0OIl) | Bitcoin addresses | 5Q |
| 62 | Base62 | 0-9, A - Z, a - z | Short URL tokens | 47 |
| 64 | Base64 | 0-9, A - Z, a - z, +, / | MIME encoding, data URIs | 3/ |