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
- Resistor colour codePick the four colour bands and get the resistance, tolerance and the range the real part can fall in.
- Ohm's law and powerEnter any two of voltage, current, resistance and power.
- Voltage dividerTwo resistors in series split the input voltage.
- RC filter cut-offGet the cut-off frequency and time constant of a first-order RC filter, low-pass or high-pass.
- RL filter cut-offGet the cut-off frequency and time constant of a first-order RL filter.
- 555 timer (astable)Get the frequency, high and low times and duty cycle of a 555 timer running in astable mode.
- Op-amp gainGet the gain of an inverting or non-inverting op-amp amplifier, in times and in dB, and the output for a given input.
- Decibel converterConvert a power or voltage ratio to decibels, or decibels back to a ratio.
- SGPA calculatorEnter each subject’s credits and grade to get your semester grade point average.
- CGPA calculatorAdd each semester’s SGPA and credits to get your cumulative grade point average.
- Digital logic toolsTruth tables, K-maps, simplifier and gates.