Skip to main content

DigitalCalculators.net

Hex Calculator

Add, subtract, multiply and divide hexadecimal numbers, or use AND, OR and XOR, and convert the result to decimal, binary and octal.

Results

ItemValue

Steps

StepWorking
Use digits 0–9 and letters A–F. A 0x prefix is allowed. Results are exact for numbers of any size. Negative results are shown with a minus sign. Bitwise operations (AND, OR, XOR) work on non-negative numbers.

Quick Answer

Hex (base 16) uses digits 0–9 and A–F, where A = 10 and F = 15. To add 1F4A + 3B7, convert to decimal (8,010 + 951 = 8,961) or add column by column with carries. The answer is 2301 in hex.

Last updated: 3 November 2026 ·How we calculate this: exact base-16 arithmetic

Table of Contents

How This Hex Calculator Works

Type two hexadecimal numbers, with or without the 0x prefix, and choose an operation. The calculator reads the numbers exactly, does the math, and shows the answer in hex, decimal, binary and octal. For division it gives the whole-number quotient and the remainder. Bitwise AND, OR and XOR are included for programming and networking work.

Quick explanation: each hex digit is worth 16 times the digit to its right.

  • Digits: 0–9, then A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
  • One hex digit: equals exactly 4 binary digits (bits).
  • FF: 255, the largest value in one byte.

How to Use the Hex Calculator

  1. Enter the first hex number.
  2. Choose the operation.
  3. Enter the second hex number.
  4. Press Calculate.
  5. Read the answer in hex, decimal, binary and octal.

Core Rules

  • Hex to decimal: sum of each digit × 16position, counting from 0 on the right
  • Decimal to hex: divide by 16 repeatedly and read the remainders from bottom to top
  • Adding: carry 1 to the next column when a column reaches 16
  • Hex to binary: replace each hex digit with its 4-bit pattern

Key Terms

  • Hexadecimal: the base-16 number system.
  • Nibble: 4 bits, equal to one hex digit.
  • Byte: 8 bits, equal to two hex digits.
  • 0x prefix: a common way to show a number is hex, like 0xFF.
  • Bitwise: operations that work on each bit, such as AND, OR and XOR.

Worked Example

Add 2F + 1A in hex.

  • Right column: F + A = 15 + 10 = 25 = 16 + 9, so write 9 and carry 1
  • Left column: 2 + 1 + 1 = 4
  • 2F + 1A = 49 (hex), which is 47 + 26 = 73 in decimal

Real-Life Examples

  • Color math: find the middle of two colors by averaging their hex values per channel.
  • Address offsets: 0x1000 + 0x2A0 = 0x12A0.
  • Bit masks: 0xF0 AND 0x3C = 0x30 keeps only shared bits.
  • Checking homework: see the decimal steps behind each answer.

Hex vs Binary vs Decimal

  • Binary (base 2): what computers use, but long to read.
  • Hex (base 16): a short way to write binary, 4 bits per digit.
  • Decimal (base 10): what people use every day.

Hex, Decimal and Binary

HexDecimalBinaryHexDecimalBinary
000000881000
110001991001
220010A101010
330011B111011
440100C121100
550101D131101
660110E141110
770111F151111

Where Hex Is Used

  • Colors: web colors like #FF8800 are three hex bytes for red, green and blue.
  • Memory addresses: programmers write addresses in hex.
  • Networking: MAC addresses and IPv6 use hex.
  • Data: hex dumps show file and network bytes.

Converting Decimal to Hex by Hand

To turn a decimal number into hex without a calculator, divide by 16 and keep the remainders.

  • Step 1: 500 ÷ 16 = 31 remainder 4
  • Step 2: 31 ÷ 16 = 1 remainder 15, which is F
  • Step 3: 1 ÷ 16 = 0 remainder 1
  • Read up: the remainders from the last to the first give 1F4, so 500 = 0x1F4

To check, go the other way: 1 × 256 + 15 × 16 + 4 = 256 + 240 + 4 = 500. The same idea works for any base, which is why this calculator can also show the result in binary (base 2) and octal (base 8).

Common Mistakes to Avoid

  • Treating A–F as letters. They are digits worth 10 to 15.
  • Carrying at 10. In hex you carry at 16.
  • Mixing up 0x10 and 10. 0x10 is 16 in decimal.
  • Using bitwise operations on negatives. Results depend on the bit width.
  • Dropping leading zeros in bytes. 0x0A is still one byte, written 0A.

Frequently Asked Questions

Add column by column from the right, carrying 1 when a column reaches 16.

Multiply each digit by 16 to the power of its position and add. 1F = 1 × 16 + 15 = 31.

255.

It marks a hex number, as in 0x1F.

Write each hex digit as 4 bits. A = 1010, so 0xA5 = 1010 0101.

Yes. The result is shown with a minus sign.

It gives the whole-number quotient and the remainder, both in hex.

A bitwise operation that gives 1 where the bits differ.

Yes. a–f work the same as A–F.

Up to 64 hex digits, calculated exactly.

It is a compact, readable way to write binary data.

A code like #3366FF, with two hex digits each for red, green and blue.

References & Sources

SourceUsed ForLink
Wikipedia, Hexadecimal The base-16 system, conversion and uses. https://en.wikipedia.org/wiki/Hexadecimal
Wikipedia, Bitwise operation How AND, OR and XOR work on bits. https://en.wikipedia.org/wiki/Bitwise_operation