Skip to Content
Hex Calculator — Add, Subtract, Multiply, Divide, Bitwise & Base Converter

Compute hexadecimal operations

Global, unit‑agnostic

Enter values in your preferred base, choose bit width and signedness, then run arithmetic or bitwise operations. Converts and formats automatically.

Hex accepts 0–9 and A–F (case‑insensitive). Prefixes like 0x are allowed.
Use B for operations that need two inputs (A op B).
Signed interprets values in two’s complement.
Left/right shift uses selected bit width; arithmetic right shift preserves the sign bit.

Division shows quotient and remainder; all results wrapped to selected bit width.

Results

Operation
Hex
Decimal
Binary
Octal
Notes

What is a hex calculator?

A hex calculator performs arithmetic and bitwise operations directly in base‑16 (hexadecimal). It also converts numbers between hex, decimal, binary, and octal, respecting bit width and two’s complement for signed values. Use it to debug low‑level code, inspect registers, calculate masks, and learn number bases with confidence.

Why hexadecimal?

  • Compact: One hex digit equals four binary bits, making long binary strings readable.
  • Developer‑friendly: Memory dumps, color codes, machine instructions, and addresses are commonly written in hex.
  • Precise control: Hex aligns naturally with bit masks and nibble boundaries.

Bit width, signedness, and wraparound

  • Bit width (n): Defines range and wrap behavior; results mask to 2^n.
  • Unsigned: Range 0 to 2^n − 1.
  • Signed (two’s complement): Range −2^(n−1) to 2^(n−1) − 1. Negative numbers are encoded by inverting bits and adding one.

Supported operations

  • Arithmetic: Add, subtract, multiply, and integer divide with quotient and remainder, masked to the chosen width.
  • Bitwise: AND, OR, XOR, NOT, left/right shifts (logical or arithmetic), and bit rotates (ROL/ROR).
  • Conversions: View any input in hex, decimal, binary, and octal with proper width and signedness.

Examples

  • 0xFF + 0x01 (8‑bit unsigned): result wraps to 0x00.
  • 0x7F + 0x01 (8‑bit signed): result becomes −128 (0x80) due to two’s complement wrap.
  • 0xF0 >> 2 (logical, 8‑bit): 0x3C; arithmetic right shift would keep the sign bit if negative in signed mode.
  • ROL(0x81, 1) (8‑bit): 0x03 (bit leaving left re‑enters on the right).

Who benefits from this tool?

  • Students: Practice base conversions, masks, and two’s complement.
  • Professionals: Debug embedded code, protocols, and bit flags quickly.
  • Educators: Demonstrate overflow, wrap, and signed vs unsigned interpretation.
  • Developers: Verify shifts, rotates, and integer boundaries across widths.

Frequently asked questions

HOW TO add two hex numbers?
Enter A and B, select bit width and signedness, then click Add. Results appear in hex, decimal, binary, and octal with wrap applied.
HOW TO subtract, multiply, or divide in hex?
Choose Subtract, Multiply, or Divide. Division returns integer quotient and remainder according to the selected signedness.
HOW TO use bitwise AND, OR, XOR, NOT?
Open the Bitwise tab and select an operation. NOT applies to a single input; results are masked to the chosen bit width.
HOW TO shift or rotate hex values?
Set the shift/rotate amount. Use A << k or A >> k for shifts; use ROL or ROR to rotate bits within the selected width.
HOW TO switch between logical and arithmetic right shift?
Pick the right shift type in settings. Logical inserts zeros; arithmetic preserves the sign bit in signed mode.
HOW TO convert between hex, decimal, binary, and octal?
Use the Converters tab. Click Convert A or Convert B to view all bases at once, honoring bit width and signedness.
HOW TO handle overflow and negative numbers?
Select the correct bit width and signedness. Overflow wraps modulo 2^n; signed mode interprets results with two’s complement.

Search Topic: Hex Calculator

Trending keywords (SEO optimized): hex calculator online, hexadecimal calculator, hex addition subtraction, hex bitwise calculator, two’s complement hex, left shift right shift hex, rotate bits hex, hex to decimal converter, decimal to hex converter, binary to hex converter, octal to hex converter, n‑bit wrap calculator, register mask calculator, embedded systems hex math