Base Converter
Convert numbers between any base from 2 to 36. Supports binary, octal, decimal, hex, and custom radix with fractional precision.
About
Positional numeral systems encode quantity using a fixed set of digits weighted by powers of a radix r. A digit d at position k contributes d ร rk to the total value. Misinterpreting the base of an address, register dump, or protocol field corrupts data silently. A hex byte FF is 255 in decimal but 11111111 in binary. This tool converts integers and fractions between any radix from 2 to 36 using arbitrary-precision integer arithmetic for the whole part and iterative multiplication for fractional digits (capped at 20 places). It does not round-trip through IEEE 754 floats for integers, so values like 264 convert without loss.
Limitations: fractional conversion may produce repeating expansions that are truncated. Negative numbers are handled via a sign flag, not two's complement. The digit alphabet follows the conventional 0 - 9, A - Z mapping (ISO 9899 / C99 strtol convention). Pro tip: when debugging network protocols, convert between base 16 and base 2 directly rather than routing through decimal to preserve bit-group readability.
Formulas
A number N in base r with digits dn dnโ1 โฆ d1 d0 . dโ1 dโ2 โฆ has decimal value:
To convert the integer part from base 10 to target base b, apply repeated division:
Digits are collected least-significant first, then reversed. For the fractional part F, iterative multiplication extracts digits most-significant first:
Where r = source radix, b = target radix, dk = digit value at position k, n = number of integer digits โ 1, m = number of fractional digits, q = quotient, F = fractional remainder.
Reference Data
| Base | Name | Digits Used | Common Use | Example (25510) |
|---|---|---|---|---|
| 2 | Binary | 0-1 | CPU registers, bitfields | 11111111 |
| 3 | Ternary | 0-2 | Balanced ternary computing | 100110 |
| 4 | Quaternary | 0-3 | DNA encoding (A,T,C,G) | 3333 |
| 5 | Quinary | 0-4 | Tally systems | 2010 |
| 6 | Senary | 0-5 | Dice arithmetic | 1103 |
| 7 | Septenary | 0-6 | Week-day indexing | 513 |
| 8 | Octal | 0-7 | Unix file permissions (chmod) | 377 |
| 9 | Nonary | 0-8 | Theoretical CS | 313 |
| 10 | Decimal | 0-9 | Everyday counting | 255 |
| 11 | Undecimal | 0 - A | ISBN check digits | 212 |
| 12 | Duodecimal | 0 - B | Dozen systems, timekeeping | 193 |
| 13 | Tridecimal | 0 - C | Rare/theoretical | 168 |
| 14 | Tetradecimal | 0 - D | Programming exercises | 143 |
| 16 | Hexadecimal | 0 - F | Memory addresses, colors (#FF) | FF |
| 20 | Vigesimal | 0 - J | Maya calendar, French 80=4ร20 | CF |
| 32 | Duotrigesimal | 0 - V | Base32 encoding (RFC 4648) | 7V |
| 36 | Hexatrigesimal | 0 - Z | URL shorteners, compact IDs | 73 |
| 60 | Sexagesimal | Mixed | Time (h:m:s), angles (degrees) | 4:15 |
| 64 | Base64 | A - Z,a - z,0-9,+,/ | Email attachments (MIME) | N/A (byte-oriented) |