Skip to main content
Tool Factory
  • English
  • Español · Review pending
  • Français · Review pending
  • Deutsch · Review pending
  • Português · Review pending
  • 日本語 · Review pending
  • 简体中文 · Review pending

Encoding & Number Bases

Binary and Hex Calculator with Bit Widths

Calculate fixed-width binary and hex arithmetic with exact 64-bit integers, two's complement results, carry, overflow, and bit diagrams.

Tool workspace

Your input stays in this browser.

The link contains what you entered. Anyone with the link can read those inputs.

The tool is ready to run.

Ready

Run the tool when your input is ready.

Input

Integer or bit pattern. Spaces and underscores separate digits.

Shift and rotate counts use Input base. Negate ignores B.

Interpretation

Ready for a result

Calculate fixed-width binary and hex arithmetic with exact 64-bit integers, two's complement results, carry, overflow, and bit diagrams.

Worked example result

Select Load example to use these values in the calculator.

A
0x7F
Operation
add
Input base
auto
Bit width
8
Interpretation
signed

Result

-128
Hexadecimal
0x80
Binary
1000 0000
Octal
0o200
Signed decimal
-128
Unsigned decimal
128

Flags

FlagValueMeaning for this operation
CF0Unsigned carry beyond the width.
OF1Signed overflow; bitwise operations clear overflow.
ZF0Result is zero.
SF1Highest result bit is 1.
PF0Low 8 bits contain an even number of ones.

Bits

76543210
A01111111
B00000001
Result10000000

Binary column working

Carry : 01111111
A     : 01111111
B     : 00000001
Result: 10000000
Each carry or borrow sits under its source bit.

127 + 1 does not fit in signed 8 bits, so the signed result wraps to -128.

Embed this tool

Select the code and copy it. You can change the height to fit your page.

The calculator retains the selected width after each operation. Interpretation determines the signed or unsigned decimal reading.

The result includes base representations, bits, and operation flags. Addition and subtraction include column calculations.

  • Check carry and signed overflow in a computer science arithmetic exercise.

Inspect an 8-bit arithmetic result

Input: 0x7F

Settings: Operation: add; B: 0x01; Bit width: 8; Interpretation: signed

Result: -128

The pattern is 0x80. OF=1, CF=0, SF=1, ZF=0, and PF=0.

Choose bit width, operation, and signed interpretation

  1. Enter A, choose Operation, and enter B or count when required.
  2. Select Input base, Bit width, and Interpretation.
  3. Select Calculate fixed-width result.
  • Only integer operands are supported.
  • The flags do not reproduce every processor rule.
  • Multiplication leaves ZF, SF, and PF unavailable.