Programmer Calculator

Convert between hex, binary, octal and decimal at 8, 16, 32 or 64 bits, flip bits, and inspect floats.

Decimal
Hex
Binary
Octal

Click a bit to flip it.

Bitwise and arithmetic operations

Uses the base, word size and signed setting above. Results wrap to the word size.


  

Floating point (IEEE 754)


    

sign exponent mantissa · hex · stored value:

Unix timestamp


    

Values of 1e11 or more are read as milliseconds, smaller values as seconds.

What this calculator does

Type a number in decimal, hex, binary or octal and see it in all four at once, at the word size you choose. Everything is calculated with exact big-integer arithmetic in your browser, so 64-bit values never lose precision and nothing is sent anywhere.

Turn on Signed to read the top bit as a sign, which is how most processors store negative integers (two's complement). The same eight bits 11111111 are 255 unsigned and -1 signed.

Common conversions

Frequently asked questions

What is two's complement?

It is the standard way to store negative integers. To negate a number, flip all its bits and add one. In an 8-bit word, -1 is 11111111 and -128 is 10000000. The range for n bits is -2n-1 to 2n-1-1.

Why is 0.1 not exact as a float?

Binary floating point can only store fractions whose denominator is a power of two exactly. 0.1 has no finite binary expansion, so the stored value is the nearest representable number. The floating point section shows the bits and the value that is actually stored.

What do the shift operations do?

A left shift by n moves bits up by n places, which multiplies by 2n until bits fall off the top. A right shift moves them down. With Signed on, a right shift copies the sign bit (arithmetic shift); with Signed off, it fills with zeros (logical shift).

Can I use prefixes like 0x?

Yes. A matching prefix is accepted and ignored: 0x for hex, 0b for binary, 0o for octal. Spaces and underscores are ignored too, so 1111_0000 works.

Is anything uploaded?

No. All calculations run locally in your browser.