Skip to content

Free guides, courses & tools across 12 engineering disciplines

Digital, networks & embedded

Number Base Converter (Binary, Hex, Octal)

Convert between binary, octal, decimal, hex and any base — with two's complement.

Computer ScienceInformation TechnologyElectrical & Electronic

Loading calculator…

Programmers and hardware engineers switch between number bases all day. This converter handles very large numbers and shows two's complement values for fixed bit widths.

How to use this calculator

  1. Type a number — prefixes like 0x, 0b and 0o are understood.
  2. Choose the base it is written in.
  3. Pick a bit width to see the signed (two's complement) value.

Formula

N = Σ digit × base^position

Worked example

0xFF = 255 = 1111 1111₂. As an 8-bit signed number 0xFF is −1.

Frequently asked questions

What is two's complement?

The standard way computers store negative integers: invert all bits of the positive number and add one.

Is there a size limit?

No practical one — the converter uses arbitrary-precision integers.

Results are for learning and preliminary design. Check critical work against the relevant codes and a qualified engineer.