Exact integer conversion between binary, octal, decimal and hexadecimal
Compare four representations of the same signed integer for programming, learning and checking numeric data. Conversion uses BigInt in your browser, preserving integers beyond the JavaScript Number safe-integer range within the stated limits.
How to convert a number base
- Enter an integer in the field for its original base. The highlighted field is the current input source.
- Read the other representations. Converted hexadecimal uses uppercase letters; the source text remains as entered.
- Copy one field or the labeled list. Invalid or incomplete input clears the other fields and disables copying.
Digits and place values in each base
- Binary (Base 2)
- Digits are 0 and 1. Each place is a power of 2: 101010 means 32 + 8 + 2, or decimal 42.
- Octal (Base 8)
- Digits run from 0 to 7. Each octal digit corresponds to three binary digits; octal 52 is decimal 42.
- Decimal (Base 10)
- Digits run from 0 to 9, with powers of 10 as place values. Leading zeros do not change the integer's value in this field.
- Hexadecimal (Base 16)
- Digits are 0 to 9 and A to F, where A means 10 and F means 15. One hexadecimal digit corresponds to four binary digits.
Number base conversion examples
- A small positive integer
- BIN 101010 · OCT 52 · DEC 42 · HEX 2A
- An unsigned byte value
- BIN 11111111 · OCT 377 · DEC 255 · HEX FF
- A negative integer
- BIN -1010 · OCT -12 · DEC -10 · HEX -A
- Beyond Number safe-integer precision
- DEC 9007199254740993
HEX 20000000000001
Negative numbers are not fixed-width two's complement
A negative result uses a minus sign followed by its magnitude, such as -1010 for decimal -10. No 8, 16, 32 or 64-bit word size is implied. The tool does not calculate two's complement, signed overflow or byte order.
Generated results omit a leading plus sign, redundant leading zeros and radix prefixes. Negative zero becomes zero in generated fields. The original input is preserved, and copy buttons copy the field text as displayed.
Number base converter FAQ
Which prefixes and input formats are supported?
Use 0b in binary, 0o in octal or 0x in hexadecimal, optionally after a plus or minus sign. Matching prefixes are case-insensitive. Outer whitespace is ignored; internal spaces, separators, decimal points and fractions are rejected.
Does 1e3 mean one thousand?
Not in the decimal field: scientific notation is not accepted. In hexadecimal, E is a valid digit, so 1E3 means decimal 483. Prefixes are interpreted only in their matching field; 0B10 in the hexadecimal field is hexadecimal B10, not binary 10.
How large an integer can I convert?
Each input allows at most 4096 digits after the optional sign and matching prefix. The absolute value must fit within 4096 binary digits, equivalent to a maximum of 2^4096 - 1. Larger inputs are rejected rather than rounded, truncated or displayed as Infinity.
Does this convert text encodings or numbers with fractions?
No. The fields represent whole-number values, not UTF-8 text, hexadecimal byte dumps or floating-point bit patterns. A period does not introduce a fractional part here. Use a suitable encoding or floating-point tool for those tasks.