Programmer Calculator

Convert between binary, octal, decimal, and hex and run fixed-width bitwise operations, all in your browser. 64-bit values are exact.

Conversions

Hex
Decimal (unsigned)
Decimal (signed)
Octal
Binary

Bitwise operation

Result · Hex
Result · Decimal (unsigned)
Result · Binary

How to convert bases and run bitwise math

  1. Enter a value and set the input base: binary, octal, decimal, or hex.
  2. Pick a bit width (8, 16, 32, or 64). It sets how binary and hex are padded, how the signed value is read, and how a result wraps if it overflows.
  3. Read the conversions of that one value: hex, unsigned and signed decimal, octal, and binary, all at once.
  4. For bitwise math, enter Operand B and choose an operation (AND, OR, XOR, NAND, NOR, XNOR, the shifts, or NOT A). The result is shown in every base.

When to use it

It suits low-level work: reading a hex register dump, checking a bitmask, or converting a flag or color value between bases without switching tools. The unsigned and signed columns show both readings of the same bits side by side, so 0xFF at 8-bit reads as 255 and as -1 at the same time.

Fixed-width behavior matters when your target is a C int or a hardware register. Set the width to match and the result wraps exactly like the real type does. It is a quick way to work out a shift amount or a mask value before you write it into code.

Frequently asked questions

Do my values get sent anywhere?

No. All conversion and bitwise math runs in your browser. Only your chosen base, bit width, and operation are remembered between visits, never the values you type.

Are 64-bit values exact?

Yes. The math uses BigInt rather than floating-point numbers, so 64-bit operands are exact. Regular JavaScript numbers lose precision above 2^53, but that doesn’t apply here.

What input formats are accepted?

Digits valid for the selected base (binary, octal, decimal, or hex), optionally with the usual 0b/0o/0x prefix, underscores as digit separators, and surrounding spaces.

How is the signed value calculated?

It’s the two’s-complement reading of the same bits at the selected width. For example, 0xFF at 8-bit shows 255 unsigned and -1 signed: same bits, two interpretations.

What happens when a result overflows the bit width?

Results are always masked back into the selected width, so they wrap around like fixed-width integers in C. The right shift is a logical (unsigned) shift.