Computer Science • Number Systems

Binary ⇄ Denary ⇄ Hex Converter

Bits
Representation

Change the number in any one of the three panels below — flick the switches, type a binary/denary/hexadecimal value directly — and watch the other two update, with the working shown step by step.

Binary

Place value × digit value, added up. When the sign bit is 1 (signed mode), the value is found by flipping every bit, adding 1, then taking that as a negative magnitude.

Denary

Type a denary (base-10) number to encode it into binary and hex.

Hexadecimal

0x

Each hex digit is one nibble (4 bits): 8 + 4 + 2 + 1 place values, 0–F.

Method reference

Place values (unsigned), most significant bit on the left:

BitsPlace values, left to right
8-bit128 · 64 · 32 · 16 · 8 · 4 · 2 · 1
16-bit32768 · 16384 · … · 8 · 4 · 2 · 1
32-bit2147483648 · … · 8 · 4 · 2 · 1

Signed (two's complement) decoding — used only when the sign (leftmost) bit is 1:

StepWhat to do
1Check the sign bit. If it's 1, the number is negative.
2Flip every bit (0↔1).
3Add 1 to the flipped bits.
4Work out the place-value sum of that result as usual.
5The answer is the negative of that sum.

Encoding a negative denary value works in reverse: convert its size (ignoring the minus sign) to binary, flip every bit, then add 1.

Binary ⇄ hex: split the bits into groups of 4 (nibbles) from the right. Each nibble is worth 8+4+2+1, giving a value 0–15, written as one hex digit (0–9, then A–F for 10–15).

This tool always shows hex as the raw bit pattern — it does not have its own separate idea of "negative"; a negative signed value and its two's complement bit pattern share the same hex.

Key terms · Ngā kupu matua

EnglishMāoriWhat it means

Māori translations are only shown where a term is attested in Te Aka Māori Dictionary (maoridictionary.co.nz). Where no widely-used term could be verified, that is shown honestly rather than guessed at.