Use this free hex calculator to add, subtract, multiply, and divide hexadecimal values. Convert between hex, decimal, and binary instantly. Perform bitwise operations like AND, OR, XOR, and bit shifts in one place.
Hex Calculator
A hex calculator lets you do math and conversions using hexadecimal numbers. Hexadecimal (base 16) is the number system that uses digits 0 through 9 and letters A through F.
This online tool handles four main tasks:
- Arithmetic: addition, subtraction, multiplication, and division of hex values
- Decimal to hex: convert any decimal value to hexadecimal
- Hex to decimal: convert any hexadecimal value to decimal
- Bitwise operations: AND, OR, XOR, NOT, and bit shifts
Enter your values above, choose an operation, and get the result immediately. The calculator accepts both uppercase and lowercase hex digits.
Hexadecimal and the Hex System
Hexadecimal Value and the Decimal System
The decimal system is the base 10 number system you use every day. It has ten digits: 0 through 9. Each position in a decimal number represents a power of 10.
The hex system works the same way, but with a base of 16. It uses sixteen symbols: 0 through 9 for values zero through nine, then A through F for values ten through fifteen. Each position represents a power of 16.
Here is how single hex digits map to decimal:
| Hex digit | Decimal value |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 9 | 9 |
| A | 10 |
| B | 11 |
| F | 15 |
A hexadecimal number like 1F means (1 × 16) + (15 × 1) = 31 in decimal. The hex system is compact. Two hex digits represent values from 0 to 255, which is the full range of one byte.
Binary and Hexadecimal
Binary is the base 2 numeral system. Computers process everything as binary digits (bits), but long strings of ones and zeros are hard for people to read.
Hexadecimal solves this. Each hex digit maps perfectly to exactly four binary digits, sometimes called nibbles.
| Hex | Binary |
|---|---|
| 0 | 0000 |
| 7 | 0111 |
| A | 1010 |
| F | 1111 |
So the binary value 11010110 becomes D6 in hex. That direct four bit grouping is why programmers, digital electronics engineers, and debuggers prefer hexadecimal notation over raw binary.
Hex Converter: Convert Decimal to Hex
Decimal Value to Hexadecimal
Converting a decimal value to hexadecimal means re-expressing a base 10 number in base 16. You divide the decimal number repeatedly by 16 and collect the remainders.
For example, to convert 255:
- 255 ÷ 16 = 15 remainder 15 (F)
- 15 ÷ 16 = 0 remainder 15 (F)
Reading the remainders from bottom to top gives FF. So 255 in decimal equals FF in hexadecimal.
Decimal to Hexadecimal Converter
The decimal to hexadecimal converter on this page handles numbers of any practical size. Enter a decimal value, and the tool returns the hex equivalent instantly.
Common conversions people look up:
- 10 decimal = A hex
- 100 decimal = 64 hex
- 256 decimal = 100 hex
- 1000 decimal = 3E8 hex
No need to do long division by hand. The converter does the work in one step.
Convert Hex to Decimal
Hexadecimal Value to Decimal
Going from a hexadecimal value to decimal reverses the process. You multiply each hex digit by its position's power of 16, then add the results.
Take the hex number 2A3:
- 2 × 16² = 2 × 256 = 512
- A (10) × 16¹ = 10 × 16 = 160
- 3 × 16⁰ = 3 × 1 = 3
Total: 512 + 160 + 3 = 675 in decimal.
Hex Decimal Converter
The hex decimal converter above accepts any valid hexadecimal number and outputs the decimal equivalent. It recognizes digits 0 through 9 and letters A through F.
If you enter an invalid character (like G or Z), the calculator will flag the error. Only the sixteen hex digits are valid input.
Hex Calculator for Arithmetic
Addition and Subtraction in Hexadecimal
Hex addition works like decimal addition, but you carry at 16 instead of 10.
Example: 1A + 2F
- A (10) + F (15) = 25. That is 1 × 16 + 9, so write 9 and carry 1.
- 1 + 2 + 1 (carry) = 4.
- Result: 49 hex.
You can verify: 1A = 26, 2F = 47, and 26 + 47 = 73 = 49 hex. ✓
Hex subtraction also mirrors decimal subtraction, but borrowing in hex means borrowing 16 instead of 10. If the top digit is smaller than the bottom digit, you borrow 16 from the next position.
Example: 43 − 1A
- 3 − A: 3 is less than 10, so borrow 16. Now 3 + 16 = 19. 19 − 10 = 9. Write 9.
- 4 − 1 (borrowed) − 1 = 2. Write 2.
- Result: 29 hex.
Multiplication and Division of Hex Values
Hex multiplication and hex division follow the same long form algorithms you learned in school. The difference is that each digit position has a base of 16.
Quick example of hex multiplication: 3 × 1F
- 3 × F (15) = 45. In hex, 45 decimal = 2D. Write D, carry 2.
- 3 × 1 = 3, plus carry 2 = 5.
- Result: 5D hex.
For larger calculations, this hex calculator handles the arithmetic operations automatically. Enter two hex values, choose the operation, and read the result.
Bitwise Calculator and Bitwise Operations
The bitwise calculator performs operations on the binary representation of your hex values. Bitwise operations compare or manipulate individual bits.
The main bitwise operations:
- AND: returns 1 only when both bits are 1
- OR: returns 1 when at least one bit is 1
- XOR: returns 1 when the bits differ
- NOT: flips every bit (ones complement)
- Left shift: moves bits to the left, filling with zeros
- Right shift: moves bits to the right
Example: A AND 6
A in binary = 1010, 6 in binary = 0110. AND gives 0010, which is 2 in hex.
Why use hex for bitwise calculations? Because each hex digit is exactly four bits, you can read the binary pattern at a glance. This is essential in digital electronics, networking (subnet masks), and low level programming.
Bit shifts work by moving the entire binary pattern left or right by a specified number of positions. A left shift by 1 doubles the value. A right shift by 1 halves it (dropping the remainder). This calculator handles both signed and unsigned interpretations.
How to Convert Decimal to Hexadecimal
Follow these steps to convert any decimal number to hexadecimal by hand:
- Divide the decimal number by 16.
- Write down the remainder. If the remainder is 10 through 15, use A through F.
- Take the quotient and divide by 16 again.
- Repeat until the quotient is 0.
- Read the remainders from bottom to top. That is your hexadecimal number.
Full example: convert 500 to hex
| Step | Quotient | Remainder | Hex digit |
|---|---|---|---|
| 500 ÷ 16 | 31 | 4 | 4 |
| 31 ÷ 16 | 1 | 15 | F |
| 1 ÷ 16 | 0 | 1 | 1 |
Read bottom to top: 1F4.
Or skip the manual work and enter 500 in the converter above.
How to Convert Hex to Decimal Value
To convert a hexadecimal value to decimal by hand:
- Write out each hex digit from left to right.
- Assign powers of 16 starting from the rightmost digit (power 0).
- Convert each hex digit to its decimal equivalent (A = 10, B = 11, etc.).
- Multiply each digit by its power of 16.
- Add all the products.
Full example: convert B4E to decimal
| Position | Hex digit | Decimal equivalent | Power of 16 | Product |
|---|---|---|---|---|
| 2 | B | 11 | 256 | 2816 |
| 1 | 4 | 4 | 16 | 64 |
| 0 | E | 14 | 1 | 14 |
Sum: 2816 + 64 + 14 = 2894.
Hexadecimal Converter for Binary
This hexadecimal converter also handles conversions between hex and binary. The process is straightforward because of the four bit relationship.
Hex to binary: replace each hex digit with its four bit binary equivalent.
- 3C → 0011 1100
Binary to hex: group the binary number into sets of four bits from the right. Pad with leading zeros if needed. Convert each group to one hex digit.
- 110101 → 0011 0101 → 35
This direct mapping is why hexadecimal is the preferred shorthand for binary numbers in computing. A 32 bit address that looks like 11000000101010000000000100000001 in binary is simply C0A80101 in hex.
Hex Calculator for Programmers and Debugging
Programmers encounter hexadecimal constantly. Memory addresses, color codes, error codes, MAC addresses, and register values all use hexadecimal notation.
Common uses:
- Memory addresses: debuggers display pointers as hex values like 0x7FFF5FBFF8AC
- File inspection: hex editors show each byte as two hex digits
- Networking: MAC addresses use six pairs of hex digits (e.g., 00:1A:2B:3C:4D:5E)
- Permissions and flags: bitwise operations on hex values control feature flags and access masks
A hex calculator is a practical tool for any programmer who needs quick arithmetic or conversions between different number systems without opening a full IDE.
Decimal Value and Hexadecimal Value in Web Colors
Web colors are one of the most common everyday uses of hexadecimal values. CSS hex color codes use six hex digits grouped as three pairs: RR, GG, BB.
Each pair is a byte representing a value from 0 to 255:
- #FF0000 = red at full intensity, no green, no blue
- #00FF00 = pure green
- #FFFFFF = white (all channels at maximum, 255)
- #000000 = black (all channels at zero)
The decimal value 255 equals FF in hex, which is why full intensity for any color channel is FF. A color like #3498DB breaks down to:
- R: 34 hex = 52 decimal
- G: 98 hex = 152 decimal
- B: DB hex = 219 decimal
Use this hex calculator to convert between the decimal RGB values you see in design tools and the hex codes your stylesheets need.
Hex Calculator Limitations
This hex calculator is a free online tool designed for quick estimates and conversions. Keep these points in mind:
- Input size: extremely large hex numbers (hundreds of digits) may exceed the calculator's precision.
- Floating point hex: this tool works with integers. It does not handle hexadecimal fractions or IEEE 754 floating point representations.
- Signed vs. unsigned: for bitwise operations, results assume unsigned values unless otherwise specified. Signed interpretation (twos complement) depends on the bit width you are working with.
- Not a substitute for professional tools: for production code, cryptographic work, or hardware design, use verified libraries and dedicated development environments.
All results are estimates and should be double checked for critical applications.