User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
Digits: 0–9
Enter a number and press Convert to see results.
Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

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).

number converter binary converter hex converter octal converter base converter roman numeral converter BCD converter gray code IEEE 754 number system

Formulas

Converting a number from any base b to decimal uses positional expansion:

N10 = kβˆ‘i=0 di β‹… bi

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:

G = n βŠ• (n >> 1)

Gray code decoding recovers n from G iteratively:

n = G, then n = n βŠ• (n >> 1), repeat until shift produces 0

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:

Sign (1 bit) | Exponent (8 bits, bias 127) | Mantissa (23 bits)

IEEE 754 double-precision (64-bit) layout:

Sign (1 bit) | Exponent (11 bits, bias 1023) | Mantissa (52 bits)

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

BaseNameDigits UsedCommon UseExample (25510)
2Binary0 - 1Digital circuits, CPUs11111111
3Ternary0 - 2Balanced ternary computing100110
4Quaternary0 - 3DNA encoding (A,T,G,C)3333
5Quinary0 - 4Tally systems2010
6Senary0 - 5Dice notation1103
7Septenary0 - 6Week-day indexing513
8Octal0 - 7Unix permissions (chmod)377
10Decimal0 - 9Everyday arithmetic255
12Duodecimal0 - 9, A - BTimekeeping, imperial units193
16Hexadecimal0 - 9, A - FMemory addresses, colorsFF
20Vigesimal0 - 9, A - JMayan numeral systemCF
32Base-320 - 9, A - VCrockford encoding7V
36Base-360 - 9, A - ZURL shorteners, compact IDs73
- RomanI, V, X, L, C, D, MClocks, chapter numberingCCLV
- BCD (8421)0000 - 1001 per digitFinancial displays, clocks0010 0101 0101
- Excess-30011 - 1100 per digitSelf-complementing arithmetic0101 1000 1000
- Gray Code0 - 1Rotary encoders, error reduction10000000
- IEEE 754 (32-bit)0 - 1 (32 bits)Single-precision floatSign + Exponent + Mantissa
- IEEE 754 (64-bit)0 - 1 (64 bits)Double-precision floatSign + Exponent + Mantissa
- ASCII0 - 127Text encoding, serial protocolsCharacter mapping

Frequently Asked Questions

Gray code is a reflected binary code constructed so adjacent values differ in exactly one bit position. This minimizes transition errors in rotary encoders and analog-to-digital converters. The encoding formula G = n βŠ• (n >> 1) guarantees this property. If multiple bits flipped simultaneously during a mechanical transition, intermediate invalid states could be read. Gray code eliminates that race condition.
Always, for multi-digit numbers. BCD encodes each decimal digit separately into 4 bits. Decimal 29 in BCD is 0010 1001 (16 bits of information: digit 2 then digit 9), whereas pure binary is 11101 (5 bits). BCD wastes bit space (codes 1010 - 1111 are unused per nibble) but preserves decimal alignment, which is critical in financial hardware and seven-segment displays where rounding errors from binary float conversion are unacceptable.
IEEE 754 single-precision (float32) carries 23 mantissa bits, giving approximately 7.2 significant decimal digits. Double-precision (float64) carries 52 mantissa bits, yielding about 15.9 significant digits. If your decimal value requires more precision than the format supports, the stored bit pattern will be the nearest representable float, not the exact value. This is why 0.1 + 0.2 β‰  0.3 in float64.
For standard positional bases (2 - 36), the tool accepts a leading minus sign and converts the absolute value, prepending the sign to outputs. Roman numerals are undefined for negative or zero values. BCD, Excess-3, and Gray code apply only to non-negative integers. IEEE 754 handles negative values natively via the sign bit. Two's complement representation is shown for binary output when the input is negative.
Base-36 uses digits 0 - 9 and letters A - Z, exhausting the standard ASCII alphanumeric set. Bases above 36 would require non-standard digit symbols (e.g., Base-64 uses + and /, which conflicts with arithmetic operators). The JavaScript parseInt and toString functions also cap at radix 36.
For IEEE 754 output, the tool accepts any valid decimal float and produces the exact bit pattern using ArrayBuffer/DataView. For positional base conversions, the tool converts the integer part via repeated division and the fractional part via repeated multiplication by the target base, limited to 32 fractional digits to prevent infinite expansion (e.g., 0.1 in binary is 0.0001100110011... repeating). Roman, BCD, Excess-3, and Gray code outputs are integer-only; fractional parts are truncated with a note.