Hex Calculator
Input Base
Operation
Result119
Decimal281
Binary100011001
Hex119
Octal431
Hexadecimal is a base-16 number system that uses the digits 0-9 and the letters A-F, widely used in programming, color codes, and memory addresses. This calculator adds, subtracts, multiplies, or divides two numbers entered in binary, decimal, hex, or octal, and shows the answer in all four bases at once. Division is integer division, so any fractional part is dropped.
Formula
result = fromBase(a) op fromBase(b); division uses floor(a / b)
- a, b
- The two operands, interpreted in the selected input base
- op
- The chosen operation: add, subtract, multiply, or divide
- floor
- Rounds down to the nearest integer (used for division)
How it works
- Pick the input base for your two values: binary (base 2), octal (base 8), decimal (base 10), or hexadecimal (base 16).
- Enter the two numbers in that base, choose an operation, and the calculator converts both to decimal, performs the arithmetic, and converts the result back.
- The answer is shown in the original base plus its decimal, binary, hex, and octal equivalents. Division uses the floor (integer division), discarding the remainder.
Worked example
Add the hexadecimal numbers A3 and 1F.
- Convert to decimal: A3 = 163, 1F = 31.
- Add in decimal: 163 + 31 = 194.
- Convert 194 back to hex: 194 = C2.
A3 + 1F = C2 in hex, which is 194 in decimal, 11000010 in binary, and 302 in octal.
Frequently asked questions
- What does hexadecimal mean and why use it?
- Hexadecimal is base 16, using 0-9 then A-F for the values 10 through 15. It is compact and maps neatly onto binary (each hex digit equals four bits), which is why programmers use it for colors, memory addresses, and byte values.
- How does the calculator handle division?
- It performs integer division using the floor function, so the result is the whole-number quotient and any remainder is discarded. Dividing by zero returns no result.
- Can I mix different bases in one calculation?
- No. Both operands are interpreted in the single input base you select. To work across bases, convert one value first, but the result is always displayed in all four bases for convenience.
- How are negative results displayed?
- If a subtraction yields a negative number, the calculator keeps a minus sign in front of the magnitude and shows that signed value consistently across the decimal, binary, hex, and octal outputs.