Hex Calculator

Hex Calculator

Hex Converter

Hex Reference

0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
A
10
B
11
C
12
D
13
E
14
F
15

Quick Reference

A= 10
B= 11
C= 12
D= 13
E= 14
F= 15

Common Hex Values

FF= 255
100= 256
FFFF= 65,535
FFFFFF= 16,777,215

Understanding Hexadecimal

What is Hexadecimal?

Hexadecimal (hex) is a base-16 number system that uses sixteen symbols: 0-9 for values zero through nine, and A-F for values ten through fifteen. It's widely used in computing because each hex digit represents exactly four binary bits.

Why Use Hexadecimal?

Compact Representation

One hex digit represents 4 bits (half a byte). This makes it much more readable than binary: 11111111 = FF.

Easy Binary Conversion

Each hex digit maps directly to 4 binary digits, making conversion straightforward without complex calculations.

Memory Addresses

Computer memory addresses are typically shown in hex because they're more manageable than long binary or decimal numbers.

Color Codes

Web colors use hex: #FF0000 is red, #00FF00 is green, #0000FF is blue. Each pair represents 0-255 intensity.

Hex to Binary Quick Reference

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

Converting Hex to Decimal

Method: Multiply by Powers of 16

Example: Convert 2AF to decimal

2AF = (2 × 16²) + (A × 16¹) + (F × 16⁰)

= (2 × 256) + (10 × 16) + (15 × 1)

= 512 + 160 + 15

= 687

Common Uses of Hex

Where You'll See Hexadecimal

  • Web colors: #FF5733, #3498DB, rgba using hex
  • Memory addresses: 0x7fff5fbff8a8
  • MAC addresses: 00:1A:2B:3C:4D:5E
  • Unicode characters: U+0041 (letter A)
  • Assembly language: MOV AX, 0xFF
  • Error codes: 0x80004005

Bitwise Operations

AND (&)

Output 1 only if both inputs are 1

F AND A = 1111 & 1010 = 1010 = A

OR (|)

Output 1 if either input is 1

F OR A = 1111 | 1010 = 1111 = F

XOR (^)

Output 1 if inputs differ

F XOR A = 1111 ^ 1010 = 0101 = 5

NOT (~)

Flip all bits

NOT F = ~1111 = 0000 = 0 (4-bit)

Frequently Asked Questions

Why do programmers use hexadecimal instead of decimal?

Hexadecimal is compact and directly maps to binary - each hex digit represents exactly 4 binary bits. This makes it much easier to read memory addresses, color codes, and binary data. For example, the binary 11111111 is simply FF in hex, versus 255 in decimal.

How do I convert hex to decimal?

Multiply each hex digit by its place value (powers of 16) and add them up. For 2AF: (2 x 256) + (A x 16) + (F x 1) = (2 x 256) + (10 x 16) + (15 x 1) = 512 + 160 + 15 = 687.

What do the letters A-F mean in hexadecimal?

In hex, we need 16 symbols for digits 0-15. Since we only have 0-9, letters A-F represent values 10-15: A=10, B=11, C=12, D=13, E=14, F=15. So FF in hex means 15x16 + 15 = 255 in decimal.

Why are web colors written in hexadecimal?

Web colors use hex because each color channel (Red, Green, Blue) ranges from 0-255, which fits perfectly in two hex digits (00-FF). The format #RRGGBB gives 16.7 million possible colors. For example, #FF0000 is pure red (255,0,0) and #00FF00 is pure green.