Hex Calculator
Convert hexadecimal to decimal, binary and octal, read a hex colour as RGB, or add, subtract, multiply, divide, AND, OR, XOR and shift hex numbers exactly.
Result
In hexadecimal: FF5733
Exact to any length: no rounding at any step.
- In decimal
- 16734003
- In binary
- 1111 1111 0101 0111 0011 0011
- In octal
- 77653463
- As a colour: red, green, blue
- 255, 87, 51
https://calcgallery.com/algebra-numbers/hex-calculator/
Results follow the mathematical operation and values shown. Check that you selected the intended operation, convention and dataset type before relying on the result. Read the full disclaimer
How to use the Hex Calculator
- Type a hexadecimal number, digits 0 to 9 and letters A to F, in either case. Start it with
- Choose an operation. Convert only shows the number in decimal, binary and octal, and a six-digit value as red, green and blue.
- For arithmetic or a bitwise operation, type the second number too.
Hex arithmetic
Hex carries at sixteen where decimal carries at ten. F + 1 is 10, FF + 1 is 100, and A × B is 110 in decimal, which is 6 × 16 + 14, written 6E.
Bitwise operations
AND, OR and XOR work on the four binary digits behind each hex digit, so FF XOR 0F is F0: the low four bits cancel and the high four stay. NOT flips every bit within the digits you typed, so NOT F0 is 0F; with no fixed width, flipping would never stop. A shift moves the bits, so shifting left by 4 adds a zero hex digit on the right.
With your numbers
- Each hex digit is worth sixteen times the one to its right: FF = 15 × 16 + 15 = 255.
Quick reference
Exact to any length: no rounding at any step.
| Example | In hexadecimal |
|---|---|
| FF to decimal | FF |
| Colour #FF5733 | FF5733 |
| Colour shorthand #F53 | FF5533 |
| FF + 1 | 100 |
| A × B | 6E |
| FF XOR 0F | F0 |
| NOT F0 | 0F |
Common questions about the Hex Calculator
- How do I convert hex to decimal?
- Each hex digit is worth sixteen times the one to its right, and the letters A to F stand for 10 to 15. FF is 15 × 16 + 15 = 255, and 100 in hex is 16 × 16 = 256. Every hex digit is exactly four binary digits, which is why programmers use hex as a compact way to write binary.
- How does a hex colour code work?
- A colour such as #FF5733 is three two-digit hex numbers side by side: red FF = 255, green 57 = 87 and blue 33 = 51, each from 0 to 255. The three-digit form doubles each digit, so #F53 means #FF5533. The page only reads a value as shorthand when it starts with #, because F53 on its own is simply the number 3,923.
- Why is FF5733 not 16,733,491?
- 16,733,491 is FF5533, a different colour with green 55 instead of 57. FF5733 is 16,734,003: 255 × 65,536 + 87 × 256 + 51.
- How big a number can the page handle?
- Sixteen hex digits, which is 64 bits, for each input, and the answers are exact at any length. Ordinary computer numbers start losing digits above about 9 × 10¹⁵, so the page uses exact whole-number arithmetic instead.