Binary and bitwise calculator

Enter a number in any base, such as 1011 in base 2 or FF in base 16. Choose a bit width to see overflow flags, two’s complement values and the IEEE 754 bit layout.

Binary and bitwise calculator calculates in your browser: the numbers you enter are never sent to a server. It is free and needs no sign-up.

How to use it

  1. Pick a tab and enter a value Choose Base conversion, Bitwise, Binary arithmetic or IEEE 754. Type a value in binary, octal, decimal or hex, and the other rows show the same value.
  2. Set the width and check overflow Choose a width such as 8 bits. In 8-bit signed arithmetic, 127 + 1 wraps to -128 and the page flags the overflow.
  3. Read the IEEE 754 pattern In IEEE 754, the float32 pattern of 0.1 is 0x3DCCCCCD, which is stored as 0.100000001490116119384765625. That is why some decimals cannot be stored exactly in binary.

Questions

Why does 127 + 1 show -128 in 8-bit arithmetic?

Signed 8-bit numbers use two’s complement, so the range runs from -128 to 127. Adding 1 to 127 goes past the top of the range and wraps around to -128, and the page marks this as an overflow.

Why does 0.1 not display exactly in float32 or float64?

Binary floating point stores the nearest value it can, not 0.1 itself. In float32 the nearest value is 0.100000001490116119384765625, and float64 keeps a different nearby value, so the two precisions show different digits.

How do I change a single bit in the Bitwise tab?

Click a bit cell to flip it between 0 and 1, and the result updates at once. The page numbers positions from 1, so check the number above a cell before you read its value.