Number Base Converter

Convert a number between binary, octal, decimal, and hexadecimal. Supports negative numbers and values up to 128 bits.

What This Tool Does

This tool converts a number between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) — the four representations that come up constantly in programming, from bitmasks and file permissions to color codes and memory addresses.

How to Use It

Choose the base your input is already in, type the number (a leading -is supported for negative values), and click Convert. All four representations — binary, octal, decimal, and hexadecimal — are shown together, so you don't need to convert twice to compare them.

The Formula

This tool converts using JavaScript's native BigInt rather than the regular Number type. That matters because Number only represents integers exactly up to 253, and silently loses precision beyond that — producing a plausible-looking but subtly wrong result rather than an obvious error. BigInt has no such ceiling, so this tool supports values up to a documented, explicit limit of 128 bits of magnitude (far beyond a 64-bit integer, which covers essentially every real-world use case), rejecting anything beyond that with a clear error rather than quietly producing an incorrect answer.

A Worked Example

Decimal 255 converts to hexadecimal FF, binary 11111111, and octal 377 — a classic reference value worth memorizing, since 255 is the maximum value of a single byte and shows up constantly (255.255.255.255, #FFFFFF in CSS, and so on). Negative numbers work the same way: decimal -255 converts to -FF, -11111111, and -377respectively — this tool represents negative values with a leading minus sign rather than two's-complement bit patterns, which is simpler to read correctly at a glance.

How to Convert Decimal to Binary Manually

The standard by-hand method is repeated division by 2, reading the remainders from bottom to top. Here's decimal 13, worked through step by step:

  1. 13 ÷ 2 = 6 remainder 1
  2. 6 ÷ 2 = 3 remainder 0
  3. 3 ÷ 2 = 1 remainder 1
  4. 1 ÷ 2 = 0 remainder 1 (stop — the quotient reached 0)

Reading the remainders from the last line to the first gives 1, 1, 0, 1, so decimal 13 is binary 1101 — which matches what this tool reports if you enter 13 in Decimal and convert it. The same repeated-division method works for any target base: to convert to octal, divide by 8 instead of 2 and read the remainders the same way; to convert to hexadecimal, divide by 16, using A–F for remainders 10–15.

FAQ

How do I convert decimal to binary by hand?
Repeatedly divide by 2 and record each remainder, then read the remainders from last to first. See the How to Convert Decimal to Binary Manually section above for a full worked example.
Does this tool support negative numbers?
Yes — enter a leading minus sign, and the result in every base is shown with the same sign.
What's the largest number this tool supports?
Up to 128 bits of magnitude, using BigInt internally so there is no precision loss — unlike JavaScript's native Number type, which loses precision above 2^53.