ECEdge

Exam: GATE 2027 exams are on 6, 7, 13, 14, 20 and 21 February 2027. Official GATE 2027 site

Binary, hex, octal and decimal converter with two’s complement

Convert between decimal, binary, hexadecimal and octal. Negative numbers also show their 8-bit and 16-bit two’s complement.

Number base converter

Type a whole number in any base to see it in the others. Negative numbers are also shown in 8- and 16-bit two's complement.

How it works

  • Type a number and choose its base.
  • Binary groups digits in fours so it is easy to read as hex.
  • Two’s complement of −x: invert all bits of x, then add 1.

Worked example

173 in decimal = 1010 1101 in binary = AD in hex = 255 in octal. −1 in 8-bit two’s complement is 1111 1111.

Common questions

Why does hex use letters?

Each hex digit covers 0 to 15, so A to F stand for 10 to 15. One hex digit is exactly four binary digits.

What range fits in 8-bit two’s complement?

−128 to 127.

More calculators