Number Base Converter (Binary, Hex)

Type a number into any field and the other bases update instantly. See the bits, two's complement, fractions and the working.

Features

  • Four linked fields for binary, octal, decimal and hexadecimal: type into any of them and the others update instantly
  • An extra field for any base from 2 to 36. Very large integers are converted exactly
  • Bit view grouped in fours. Click a bit to flip it, and see when a value overflows 8, 16, 32 or 64 bits
  • Negative numbers in two's complement, and a choice of reading binary/hex values as unsigned or signed
  • Fractions such as 0.1 → 0.000110011…, with the repeating digits of recurring fractions marked
  • Step-by-step working: repeated division, repeated multiplication and positional expansion

Use cases

Exam practice

Check binary fractions and two's complement answers against the working.

Computer science class

Follow decimal-to-binary conversion one division at a time.

Programming

Inspect hex colour codes, bit flags and masks bit by bit.

Big numbers

Convert integers beyond 64 bits, such as 2⁶⁴+1, without losing digits.

Privacy

Numbers are calculated only in your browser and are never sent anywhere. The last number and settings are kept on this device (browser storage) so they are there next time.

FAQ

How do I convert decimal to binary?

Divide by 2 and write down the remainder, repeat until the quotient is 0, then read the remainders from bottom to top. For 255 all eight remainders are 1, so it is 11111111. Open "Working" to see the steps for your number.

What is two's complement?

It is how computers store negative integers. Flip every bit of the positive number and add 1. At 8 bits, 1 is 00000001 and −1 is 11111110 + 1 = 11111111. If the leftmost bit is 1, the value is read as negative.

Why doesn't 0.1 terminate in binary?

A fraction terminates in binary only if its denominator is a power of 2 (1/2, 1/4, 1/8 …). 0.1 = 1/10 has a factor of 5, so it becomes 0.0001100110011… with 0011 repeating forever. 0.625 = 5/8 terminates as 0.101.

What input formats are accepted?

Prefixes such as 0b1010, 0o17 and 0xFF, separators like 1111_0000 or 1111 0000, full-width digits and upper- or lowercase hex. You can also paste 0x… into the decimal field. If a character is not valid for the base, it is highlighted.

What is the difference between unsigned and signed?

They are two ways of reading the same bits. At 8 bits, 11111111 is 255 unsigned and −1 signed (two's complement). With "Signed" selected, values typed into the binary, octal and hex fields are read this way.

Is anything I type sent to a server?

No. All calculations happen in your browser.

Related tools

Prefixes 0b, 0o and 0x, spaces or _ as separators and full-width digits are all accepted. Fractions (0.1) and negative numbers (−5) work too.

Everything is calculated in this browser. The numbers you type are never sent anywhere.

Bits

Bit width
Read binary / octal / hex as

With "Signed", the binary, octal and hex fields are read and written as fixed-width two's complement (FF at 8 bits is −1).

Click a bit to flip it between 0 and 1; the fields above update. The small number under each bit is its position (0 is the rightmost).

You can also click bits to build a number.

Working

Enter a number to see the steps here.