All Number Converter
Convert numbers between binary, octal, decimal, hex, Roman, BCD, Gray code, IEEE 754, Base-2 to Base-36, and ASCII instantly.
About
Misinterpreting a number base causes silent data corruption. A hex value FF read as decimal yields 255 in one context and a parsing error in another. This tool converts any integer or floating-point input across all standard numeral systems: binary (baseβ2), octal (baseβ8), decimal (baseβ10), hexadecimal (baseβ16), and any arbitrary base from 2 to 36. It also handles Roman numerals (subtractive notation, valid for 1 - 3999), Binary-Coded Decimal (BCD), Gray code (reflected binary), Excess-3 code, IEEEΒ 754 single- and double-precision float representations, and ASCII/Unicode code points.
Conversion logic uses parseInt with radix for standard bases, BigInt for arbitrary-precision integers, and ArrayBuffer/DataView for exact IEEEΒ 754 bit patterns. Roman numeral encoding follows the subtractive principle per ISOΒ 80000-2. Note: Roman output is limited to integers 1 - 3999. BCD and Excess-3 apply only to non-negative integers. Gray code conversion uses the identity G = n β (n >> 1).
Formulas
Converting a number from any base b to decimal uses positional expansion:
where di is the digit at position i (from right, zero-indexed), b is the source base, and k is the number of digits minus one. Converting from decimal to target base b uses repeated division: divide by b, collect remainders in reverse order.
Gray code encoding from binary integer n:
Gray code decoding recovers n from G iteratively:
BCD encoding maps each decimal digit to its 4-bit binary equivalent independently. Excess-3 adds 3 (00112) to each BCD nibble, yielding self-complementing properties for subtraction.
IEEE 754 single-precision (32-bit) layout:
IEEE 754 double-precision (64-bit) layout:
where value = (β1)sign Γ 2(exp β bias) Γ (1 + mantissa).
Roman numeral subtractive rules: I before V/X, X before L/C, C before D/M. Valid range: 1 - 3999.
Reference Data
| Base | Name | Digits Used | Common Use | Example (25510) |
|---|---|---|---|---|
| 2 | Binary | 0 - 1 | Digital circuits, CPUs | 11111111 |
| 3 | Ternary | 0 - 2 | Balanced ternary computing | 100110 |
| 4 | Quaternary | 0 - 3 | DNA encoding (A,T,G,C) | 3333 |
| 5 | Quinary | 0 - 4 | Tally systems | 2010 |
| 6 | Senary | 0 - 5 | Dice notation | 1103 |
| 7 | Septenary | 0 - 6 | Week-day indexing | 513 |
| 8 | Octal | 0 - 7 | Unix permissions (chmod) | 377 |
| 10 | Decimal | 0 - 9 | Everyday arithmetic | 255 |
| 12 | Duodecimal | 0 - 9, A - B | Timekeeping, imperial units | 193 |
| 16 | Hexadecimal | 0 - 9, A - F | Memory addresses, colors | FF |
| 20 | Vigesimal | 0 - 9, A - J | Mayan numeral system | CF |
| 32 | Base-32 | 0 - 9, A - V | Crockford encoding | 7V |
| 36 | Base-36 | 0 - 9, A - Z | URL shorteners, compact IDs | 73 |
| - | Roman | I, V, X, L, C, D, M | Clocks, chapter numbering | CCLV |
| - | BCD (8421) | 0000 - 1001 per digit | Financial displays, clocks | 0010 0101 0101 |
| - | Excess-3 | 0011 - 1100 per digit | Self-complementing arithmetic | 0101 1000 1000 |
| - | Gray Code | 0 - 1 | Rotary encoders, error reduction | 10000000 |
| - | IEEE 754 (32-bit) | 0 - 1 (32 bits) | Single-precision float | Sign + Exponent + Mantissa |
| - | IEEE 754 (64-bit) | 0 - 1 (64 bits) | Double-precision float | Sign + Exponent + Mantissa |
| - | ASCII | 0 - 127 | Text encoding, serial protocols | Character mapping |