Number Base Converter
Convert an integer between binary, octal, decimal, hex and any base 2–36.
Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.
About this tool
Converts an integer between number bases. Enter a value in any base from 2 to 36 — 0x, 0b and 0o prefixes and underscore or space grouping are accepted — and it is shown in binary, octal, decimal and hexadecimal together. Choose an 8, 16, 32 or 64-bit width to see the fixed-width representation, and turn on Signed to interpret and display negatives as two's complement (−5 in an 8-bit signed field shows as 11111011 / 0xFB). Parsing and arithmetic use JavaScript's BigInt, so a 64-bit value or a 200-digit number is exact, not rounded. This is the general-purpose converter; the IP Base Converter handles the IPv4-specific case (dotted-decimal, integer, reverse DNS).
How it works
value = Σ digit × base^position (rightmost position = 0) To convert down: divide by the target base, read remainders bottom-up
Every positional number system works the same way; only the base changes. Binary uses powers of 2, octal 8, decimal 10 and hex 16. Hex is popular because one hex digit is exactly four bits. Negative numbers in a fixed width use two's complement: the bit pattern of 2^width − |n|.
| Question | Working | Answer |
|---|---|---|
| 255 in binary, octal and hex | 255 = 128+64+32+16+8+4+2+1 | 11111111, 377, FF |
| Binary 1010 in decimal | 1×8 + 0×4 + 1×2 + 0×1 | 10 (hex A) |
| −1 as a signed 8-bit number | 2^8 − 1 = 255 | 11111111, hex FF |
When to use it
Questions
Why is −5 shown as 11111011?
That is the 8-bit two's-complement representation, which is how signed integers are actually stored. With a width selected and Signed turned on, a negative value is displayed as the bit pattern a CPU would hold: 2^8 − 5 = 251 = 11111011. The decimal row still shows −5.
What is the largest number this handles?
There is no practical limit. Values are parsed into BigInt, so a 64-bit integer, a 128-bit UUID as a number, or an arbitrarily long decimal string all convert exactly. Fixed-width modes reject anything that would not fit the chosen width.
Can I enter a negative hex or binary number?
A leading minus sign is only accepted for base-10 input. For other bases, use a bit width and the Signed option — that is the meaningful way to express a negative value in binary or hex, as a two's-complement pattern.
What does the 0x / 0b / 0o prefix do?
Nothing beyond convenience — it lets you paste a value in the form it appears in code. The prefix must match the selected input base (0x with base 16, 0b with base 2, 0o with base 8); a mismatch is reported rather than guessed.