Hex Calculator

Convert between decimal and hexadecimal

Hex Converter

Enter a decimal integer

Formula
Divide by 16 repeatedly

What is a Hex Calculator?

A Hex Calculator is a tool for working with hexadecimal numbers (also called hex), which use base 16 instead of base 10. Hexadecimal uses sixteen symbols: 0–9 and A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

Hex is widely used in computing because it’s a compact way to represent binary data. Since 1 hex digit equals 4 binary bits, long binary values can be written much shorter in hex. For example: binary 1111 = hex F, and binary 10101100 = hex AC.

This Calculator Supports Multiple Conversions

  • Decimal → Hexadecimal -- convert base-10 numbers to base-16
  • Decimal → Binary -- convert base-10 numbers to base-2

Hex calculators are useful for converting between hex, decimal, and binary, working with colors in web design (e.g., #FF0000 for red), and understanding memory addresses, machine code, and other low-level computing concepts.

How to Use This Hex Calculator

  1. Enter a decimal number -- type any integer into the input field (e.g., 255)
  2. Click "Calculate" -- to convert the number
  3. Review both outputs -- the result shows the hexadecimal (base 16) and binary (base 2) representations simultaneously
  4. Try other values -- explore common values like 16, 128, 255, 256, or any decimal you need to convert

Tips:

  • Hex values often appear with a prefix like 0x (example: 0xFF). This calculator displays the raw hex digits without a prefix.
  • Hex uses only 0–9 and A–F. If you see an error, check for invalid characters.
  • Leading zeros (like 00FF) don’t change the value, but can be useful when you want a fixed byte length.

Hex Formulas

Hex Place Value (Base 16)

Hex works like decimal place value, but with powers of 16:

value = Σ dᵢ × 16ⁱ (i = 0 to k)

Where each digit dᵢ can be 0–15 (0–9 or A–F)

Example: 1A₁₆ = 1×16¹ + 10×16⁰ = 16 + 10 = 26₁₀

Converting Decimal to Hex

Repeatedly divide by 16 and record remainders:

  1. Divide the number by 16
  2. Record the remainder (0–15, using A–F for 10–15)
  3. Divide the quotient by 16 and repeat until the quotient is 0
  4. Read the remainders from bottom to top

Hex to Binary Conversion Table

Each hex digit maps directly to a 4-bit binary group:

0

0000

1

0001

2

0010

3

0011

4

0100

5

0101

6

0110

7

0111

8

1000

9

1001

A

1010

B

1011

C

1100

D

1101

E

1110

F

1111

Hex Addition (Concept)

Hex addition follows the same idea as decimal addition, but carries happen at 16 instead of 10. If a digit sum is 16 or more, write the remainder and carry 1 to the next place.

Example Calculations

Example 1: Convert Hex to Decimal

Convert: 1A₁₆ to decimal

Calculation: 1×16 + 10 = 26

Result: 1A₁₆ = 26₁₀

Example 2: Convert Hex to Binary

Convert: 2F₁₆ to binary

Steps:

  • 2 = 0010
  • F = 1111

Result: 2F₁₆ = 00101111₂

Example 3: Convert Decimal to Hex

Convert: 255₁₀ to hex

Steps:

  • 255 ÷ 16 = 15 remainder 15
  • 15 in hex = F, remainder 15 = F

Result: 255₁₀ = FF₁₆

Example 4: Hex Addition

Add: A5₁₆ + 1C₁₆

Verify via decimal:

  • A5₁₆ = 10×16 + 5 = 165
  • 1C₁₆ = 1×16 + 12 = 28
  • 165 + 28 = 193
  • 193 ÷ 16 = 12 remainder 1 → C1

Result: A5₁₆ + 1C₁₆ = C1₁₆

Frequently Asked Questions

Why is hexadecimal used in computing?

Hex is a compact way to represent binary. Since 1 hex digit equals 4 bits, it’s much easier to read and write than long binary strings, especially for memory addresses and machine data.

What do the letters A–F mean in hex?

They represent values 10 through 15: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

What’s the difference between hex and binary?

Binary is base 2 (0 and 1). Hex is base 16 (0–9 and A–F). Hex is often used as a shorthand for binary because it compresses 4 bits into 1 character.

What does "0x" mean in front of a number?

"0x" is a common prefix used in programming to indicate a hexadecimal number. For example, 0xFF means FF in hex (255 in decimal).

Why do hex values appear in colors like #FF0000?

In web design, colors are commonly represented as three hex pairs for Red, Green, and Blue (RGB). Each pair ranges from 00 to FF (0 to 255 in decimal). For example, #FF0000 is full red, no green, no blue.

Embed This Hex Calculator on Your Website

Want to add this hex calculator to your website? Get a custom embed code that matches your site's design and keeps visitors engaged.

Responsive design
Custom styling
Fast loading
Mobile optimized