About this tool
Add, subtract, multiply and divide hexadecimal numbers, apply AND, OR, XOR and shifts, convert hex to decimal, binary and octal, with carry steps.
This hex calculator adds, subtracts, multiplies and divides hexadecimal numbers and applies bitwise AND, OR, XOR, NOT, NAND, NOR and shifts. Results appear at once in hex, decimal, binary and octal, and a separate base converter turns any hex, decimal, binary or octal value into the other three as you type. Unlimited mode works on numbers of any length with exact BigInt arithmetic; Unsigned and Signed (two's complement) modes at 8, 16, 32 or 64 bits wrap and flag overflow like a real register. Hex addition and subtraction are worked column by column with each carry or borrow, and six-digit values are previewed as RGB colours. Nothing leaves your browser.
Open Hex Calculator on AltFTool — it loads instantly in your browser.
Type hexadecimal values into A (hex) and B (hex) — digits 0–9 and A–F, upper or lower case, with or without a 0x or # prefix.
Choose +, −, ×, ÷ or a bitwise operation such as AND, OR, XOR or << shift; division gives both the quotient and the remainder.
Leave Number mode on Unlimited, or pick Unsigned or Signed (2's comp.) with a Bit width of 8, 16, 32 or 64 bits for register-style wrap-around.
Read the answer in hex, decimal, binary and octal, follow the column carries in the Working card, and use the Base converter or Copy all to take the values with you.
The Base converter panel converts hex ↔ decimal ↔ binary ↔ octal live, and Use as A or Use as B sends the value into the calculator.
Each column of an addition is spelled out, for example F + 9 + carry 1 = 25 = 1 × 16 + 9, so you can see why the digit and carry are what they are.
Pick a bit width of 8, 16, 32 or 64 to see negative numbers as FF…, catch signed overflow and compare signed and unsigned readings of the same pattern.
AND, OR, XOR, NAND, NOR, XNOR and NOT, plus left shift, arithmetic and logical right shift and rotates, with a bit-by-bit table of the result.
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 2 | 10 |
| 3 | 3 | 11 |
| 4 | 4 | 100 |
| 5 | 5 | 101 |
| 6 | 6 | 110 |
| 7 | 7 | 111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
| 10 | 16 | 1 0000 |
| 20 | 32 | 10 0000 |
| 40 | 64 | 100 0000 |
| 64 | 100 | 110 0100 |
| 7F | 127 | 111 1111 |
| 80 | 128 | 1000 0000 |
| FF | 255 | 1111 1111 |
| 100 | 256 | 1 0000 0000 |
| FFF | 4095 | 1111 1111 1111 |
| FFFF | 65535 | 1111 1111 1111 1111 |
Each hex digit is exactly four binary digits, which is why two hex digits describe one byte (00 to FF = 0 to 255).
Add column by column from the right, using the values A = 10 to F = 15. When a column total reaches 16 or more, subtract 16, write that digit and carry 1 to the next column. For example F + 9 = 24, which is 1 × 16 + 8, so write 8 and carry 1. So FF + 1 = 100 in hex, which is 255 + 1 = 256.
Subtract column by column from the right. If the top digit is smaller than the bottom digit, borrow 1 from the column to the left, which adds 16 to the current column. For example 1A3F − B7: F − 7 = 8, then 3 − B needs a borrow, so 19 − 11 = 8, giving 1988. The Working card shows each borrow.
Multiply each hex digit by a power of 16 based on its position from the right — 1, 16, 256, 4096 and so on — and add the results, counting A as 10 through F as 15. For example 2F = 2 × 16 + 15 = 47, and 1A3 = 1 × 256 + 10 × 16 + 3 = 419. The Base converter here does this as you type.
Divide the number by 16 repeatedly and write down the remainders, using A to F for 10 to 15. Read the remainders from last to first. For 419: 419 ÷ 16 = 26 remainder 3, 26 ÷ 16 = 1 remainder 10 (A), 1 ÷ 16 = 0 remainder 1, so 419 = 1A3 in hex. Type a decimal value in the converter to check.
Use long multiplication in base 16: multiply A by each digit of B, shifting each row one hex place left, then add the rows with hex carries. It is often easier to convert to decimal, multiply and convert back. For example 7B × 2C is 123 × 44 = 5412, which is 1524 in hex.
FF in hexadecimal is 255 in decimal, because F is 15 and FF = 15 × 16 + 15. It is the largest value that fits in one byte (8 bits, 11111111 in binary). As an 8-bit signed two's complement number the same pattern means −1, which you can see by switching Number mode to Signed with an 8-bit width.
Hardware stores negative numbers in two's complement, so −1 in 8 bits is FF, in 16 bits FFFF and in 32 bits FFFFFFFF. A pattern is negative when its top hex digit is 8 to F. In Unlimited mode this calculator shows negative results with a minus sign instead, such as −1A, because there is no fixed width.
Hex is a compact way to write binary: one hex digit stands for exactly four bits, so a byte is always two digits and a 32-bit value is eight. That makes memory addresses, colour codes, machine code, hashes and bit masks much easier to read and type than long strings of 0s and 1s, while staying easy to convert by hand.
Web colours are written as six hex digits, #RRGGBB, with two digits each for red, green and blue from 00 to FF. So FF8800 is orange: red 255, green 136, blue 0. When an input or result has exactly six hex digits, this calculator shows a swatch with its rgb() value, which is handy for lightening or mixing colours.
Choose ÷ and the result shows the whole-number quotient and the remainder, both in hex and decimal, plus a check line that A = quotient × B + remainder. For example FFFF ÷ 1F gives 842 remainder 1, because 842 × 1F + 1 = FFFF. The Working card shows hex long division one digit at a time, with how many times B fits at each step.
Add the Hex Calculator widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.
<iframe src="https://www.altftool.com/embed/widget/hex-calculator"
title="Hex Calculator — free AltFTool widget"
width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/hex-calculator?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>