Number base converter

Type a number in any base to see it in all the others. Negative numbers are shown in two’s complement.

Inputs

Result

Decimal200
HexC8
Binary1100 1000
Octal
310
Bit pattern (16-bit)
0000 0000 1100 1000
Bit pattern hex
00C8
Unsigned
200
Signed (two’s complement)
200
Bits set
3
Embed on your site

Paste this code into your page’s HTML. The tool sets its own height, and the link to Kalkio has to stay visible.

Calculator by Kalkio · kalkio.app

How base conversion works

Each digit is weighted by a power of the base. In binary, 1101 is 1·8 + 1·4 + 0·2 + 1·1 = 13. One hex digit is exactly four bits, which is why hex is handy for registers and addresses: 0xC8 = 1100 1000 = 200.

Two’s complement

Computers and PLCs store negative numbers in two’s complement, where the top bit has a negative weight. In 16 bits, −1 is FFFF and −200 is FF38. Tick “signed” to read a hex or binary number this way.

Common questions

How do I write a negative number in hex?

Type it in decimal with a minus sign and pick the word size. The “Bit pattern hex” row shows its two’s complement, e.g. −1 in 16 bits is FFFF.

Can I type 0x or 0b first?

Yes. The 0x, 0b and 0o prefixes are ignored, as are spaces and underscores.