CCalculate.Studio

🔡 Hex Calculator

This hex calculator performs arithmetic — addition, subtraction and multiplication — directly on hexadecimal numbers, and also converts a single hex value to decimal and binary. Hexadecimal (base 16) uses the digits 0–9 and the letters A–F, and is the standard compact notation for binary data because each hex digit represents exactly four bits.

Dernière vérification: 2026-07-07

Vos informations

Résultats

Hex result49
Decimal73
Binary1001001

Hex digit reference table

Each hexadecimal digit corresponds to one value from zero to fifteen and to exactly four binary digits.

Hex digitDecimal valueBinary (4 bits)
000000
110001
440100
770111
991001
A101010
C121100
F151111
  • Inputs are limited to 12 hex digits per operand, and results must stay within the exact-integer range of IEEE 754 double precision (2⁵³ − 1); larger results are rejected rather than rounded.
  • Subtraction can produce a negative result, shown with a minus sign; two's-complement representation is not used here.

What is hexadecimal arithmetic?

Hexadecimal is a base-16 positional number system: each digit position represents a power of 16, and the sixteen digit symbols are 0–9 followed by A (ten), B (eleven), C (twelve), D (thirteen), E (fourteen) and F (fifteen). The hex number 1A means 1×16 + 10 = 26 in decimal, and 2F means 2×16 + 15 = 47.

Arithmetic in hexadecimal follows the same rules as decimal arithmetic, except that carrying and borrowing happen at sixteen instead of ten. Adding the hex digits A and F gives twenty-five, which is 19 in hex — write 9, carry 1. Most people find it easier to convert to decimal, compute, and convert back, which is exactly what this calculator does internally.

Hexadecimal earns its place in computing because 16 = 2⁴: one hex digit maps to exactly four binary digits, so a byte (8 bits) is always two hex digits, from 00 to FF. Memory addresses, color values, checksums and raw byte dumps are conventionally written in hex, often with the prefix 0x.

How to use this hex calculator

  1. Enter the first hexadecimal number (digits 0–9 and A–F; an optional 0x prefix is accepted).
  2. Choose the operation: add, subtract, multiply — or convert, which translates the first number only.
  3. For arithmetic, enter the second hex number.
  4. Read the result in hexadecimal, decimal and binary. In convert mode the output shows the decimal and binary forms of the first number.

The math behind hex arithmetic

value = Σ (digit at position i) × 16ⁱ, with A=10, B=11, C=12, D=13, E=14, F=15
1A₁₆ + 2F₁₆ = 26 + 47 = 73 = 49₁₆

Each operand is evaluated digit by digit against powers of 16 to obtain its decimal value; the operation is performed on the decimal values; the result is then re-expressed in base 16 by repeated division.

Worked example: 1A + 2F. In decimal, 1A = 26 and 2F = 47, so the sum is 73. Converting back: 73 ÷ 16 = 4 remainder 9, so 73 = 49 in hexadecimal and 1001001 in binary. Column-wise the same happens digit by digit: A + F = 25 = 19₁₆, write 9 carry 1; then 1 + 2 + 1 = 4 — giving 49₁₆.

Common mistakes

  • Carrying at ten instead of sixteen when adding hex digits by hand — A + F is 19₁₆ (write 9, carry 1), not 25.
  • Reading hex numbers as decimal: 10₁₆ is sixteen, not ten, and 100₁₆ is 256.
  • Confusing the letter O with the digit 0, or lowercase l with 1, when transcribing hex values.
  • Forgetting that a byte is exactly two hex digits — dropping a leading zero (0x0F → F) is harmless numerically but breaks fixed-width byte notation.

Questions fréquentes

How do I add two hexadecimal numbers?

Add column by column from the right, exactly like decimal addition, but carry when a column reaches sixteen. For 1A + 2F: A (10) + F (15) = 25 = 16 + 9, so write 9 and carry 1; then 1 + 2 + 1 = 4. The result is 49 in hex, which is 73 in decimal.

What does 0x mean in front of a number?

The prefix 0x marks a number as hexadecimal, distinguishing it from decimal. It comes from the C programming language and is now near-universal: 0x1A means hexadecimal 1A, i.e. 26 in decimal. This calculator accepts hex input with or without the prefix.

How do I convert hex to decimal?

Multiply each hex digit's value by the power of 16 for its position, counting from 0 at the right, and sum. For 2F: 2×16 + 15×1 = 47. For 1A3: 1×256 + 10×16 + 3×1 = 419. The letters A–F stand for the values 10–15.

How do I convert hex to binary?

Replace each hex digit with its 4-bit binary equivalent: 2F becomes 0010 1111. This digit-by-digit shortcut works because 16 = 2⁴, so no arithmetic is needed — it is the main reason hexadecimal is used as shorthand for binary data.

Can this calculator handle negative hex numbers?

Subtraction can yield a negative result, which is displayed with a leading minus sign (for example 5 − A = −5). The calculator does not use two's-complement encoding, the fixed-width convention processors use internally, where the same bit pattern can mean either a large unsigned value or a negative signed one.

Références

  1. Knuth DE. The Art of Computer Programming, Volume 2: Seminumerical Algorithms, 3rd edition, Addison-Wesley, 1997 — radix arithmetic and conversion.
  2. IEEE Std 754-2019. IEEE Standard for Floating-Point Arithmetic — exact-integer limits of double precision.

Systèmes numériques · Tous les calculateurs

Calculateurs associés