hexadecimal arithmetic: methods, examples and limits
How to calculate and convert
Choose arithmetic, conversion to decimal or conversion from decimal. Arithmetic uses two values in base 16, except NOT, which uses only the first. Shift counts are always decimal. The result card shows binary, decimal and hexadecimal simultaneously. Calculate A7 + 19 = C0 (167 + 25 = 192). Try the example button, then change either input; an edited input clears the previous answer so it cannot be mistaken for the new result.
Understand place value
Each position has weight 16 raised to its index from the right, starting at zero. A7₁₆ = 10 × 16¹ + 7 × 16⁰ = 167₁₀. The conversion preserves the number while changing its written representation. Powers explain the positional weights. Binary uses 0 and 1; hexadecimal uses 0–9 and A–F, with A = 10 through F = 15. One hexadecimal digit corresponds to four binary bits. Leading zeros do not change the integer value.
Addition, subtraction and multiplication
Column arithmetic carries when a column reaches the base: in binary, 1 + 1 = 10; in hexadecimal, F + 1 = 10. Borrowing subtracts one higher place and adds a full base to the current place. Multiplication combines shifted partial products. This tool uses exact integer arithmetic rather than converting operands to floating-point numbers, so large integers retain every digit. Arithmetic has no fixed word width and does not silently wrap on overflow.
Division, fractions and negative values
Division returns an exact reduced fraction when the answer is not an integer. In binary, 101 ÷ 10 = 101/10, which equals decimal 5/2. The separate quotient and remainder describe integer division toward zero: -5 divided by 2 has quotient -2 and remainder -1, because -5 = 2 × (-2) + (-1). The remainder is zero or has the dividend’s sign, and its magnitude is smaller than the divisor’s. Zero divisors are rejected. A leading minus always means an ordinary negative integer; an unsigned digit string is never automatically decoded as two’s complement.
Bitwise operations and word width
AND retains bits set in both operands; OR retains bits in either; XOR retains bits that differ. NOT flips every bit inside the selected width. For 8 bits, NOT 00001111 gives 11110000, decimal 240. Both inputs must fit the unsigned word. Logical right shift inserts zeros. Left shift discards bits beyond the chosen width, equivalent to multiplication by a power of two modulo 2^width. With 8 bits, 128 shifted left once gives 0. There is no signed arithmetic shift or implicit signed interpretation.
Input limits, privacy and useful tools
Use up to 4096 binary digits, 1024 hexadecimal digits or 1234 decimal digits, with magnitude below 2^4096. Optional 0b and 0x prefixes are accepted in their matching bases. Hex letters are case-insensitive. Binary/hex digit groups may be separated by a single space or underscore; decimal grouping, decimal points, exponents and expressions are rejected. Exact multiplication can produce up to 8192 result bits. Copy, CSV and Print / Save as PDF include the current working. Nothing is uploaded for calculation.
For binary arithmetic and conversions, use Binary Calculator. For individual powers and missing exponent or base values, use Exponent Calculator. For exact fraction arithmetic, use Fraction Calculator.
The notation reference ISO 80000-2:2019 covers mathematical symbols. It is not an integer-encoding specification and does not certify this tool. Signed inputs, unsigned bit widths and division conventions are defined explicitly above.
Common questions
Are the results exact for large numbers?
Yes, integer arithmetic and reduced division fractions use arbitrary-precision integers within the stated input limits. The tool does not round operands to 53-bit floating-point integers.
Does 11111111 mean -1?
No. It means positive 255 in binary. Enter -1 for negative one. Bitwise modes accept unsigned values only; an 8-bit NOT of zero is 255.
Does the word width limit addition?
No. Width applies only to bitwise operations and logical shifts. Ordinary addition, subtraction, multiplication and division remain exact without fixed-width wrapping.
Can I enter fractions or fractional digits?
This tool accepts integers. Division may return an exact fraction. Use the linked Fraction Calculator to work with fractional operands.