Two's complement to decimal converter

Paste a value from a log, memory dump or processor register to see the signed number it holds.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter input format and value.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

If the first bit is 0 the value is the plain binary value. If it is 1, the value = unsigned value minus 2 to the power n, where n is the bit count.

Example

Inputs: Input format = Binary, Value = 11010110. Result: Signed decimal: -42; Bit width: 8.

11010110
-42

Limits and caveats

  • The width comes from the input length, so type the leading zeros when a positive value has a wider width.
  • Does not read floating-point formats.

Questions about this tool

What is 11010110 in two's complement?

Its unsigned value is 214 and the first bit is 1, so the value is 214 minus 256 = -42.

Why does the bit width matter?

1111 in 4 bits is -1, but 00001111 in 8 bits is 15. The first bit decides the sign.

How do I read a hex value like FFD6?

Choose the hex format. Each digit becomes 4 bits, the width is 16, and the result is -42.