Hex Calculator

Convert between hexadecimal and decimal or perform hex arithmetic with step-by-step results.

d = Σ(hᵢ × 16ⁱ)
d= Decimal value
hᵢ= Hex digit value (0-15)
i= Position from right

Tips & Notes

  • Hex digits A-F represent values 10-15.
  • Each hex digit maps to exactly 4 binary bits.
  • Two hex digits = one byte (0-255).
  • Prefix hex with 0x in most programming languages.

Common Mistakes

  • Using letters beyond F in hex notation.
  • Confusing hex A (10) with decimal 10.
  • Forgetting that hex is case-insensitive: FF = ff = Ff.
  • Miscounting positions when converting large hex numbers.

Hex Calculator Overview

What This Calculator Does

The Hex Calculator provides bidirectional conversion between hexadecimal and decimal number systems. Enter a decimal number to see its hex representation, or enter a hex string to find its decimal equivalent. The calculator accepts hex digits 0-9 and A-F (case-insensitive).

Hexadecimal uses 16 symbols: 0-9 represent values zero through nine, and A-F represent ten through fifteen. Each position in a hex number represents a power of 16, just as decimal positions represent powers of 10. The hex number 2F3 equals 2×16² + 15×16¹ + 3×16⁰ = 512 + 240 + 3 = 755 in decimal.

Hex in Computing

Hexadecimal is ubiquitous in computing because it maps perfectly to binary: each hex digit corresponds to exactly four bits. This makes hex the natural shorthand for binary data. A byte (8 bits) is always exactly two hex digits, and a 32-bit value is exactly eight hex digits. This fixed-width mapping makes hex far more readable than binary for representing machine-level data.

CSS color codes use hex notation: #FF0000 is pure red (255 red, 0 green, 0 blue). Memory addresses in debuggers display as hex. Unicode code points are expressed in hex (U+00E9 for accented e). MAC addresses use hex pairs separated by colons.

Converting Between Systems

To convert decimal to hex, repeatedly divide by 16 and record remainders. The remainders, read bottom to top, form the hex representation. For 755: 755÷16 = 47 remainder 3, 47÷16 = 2 remainder 15 (F), 2÷16 = 0 remainder 2. Reading bottom to top: 2F3.

To convert hex to decimal, multiply each digit by its positional power of 16 and sum. The calculator shows these steps explicitly for both conversion directions.

Frequently Asked Questions

Digits 0-9 and letters A-F (or a-f). Each represents a value from 0 to 15.

CSS colors use three bytes for RGB channels. Hex represents each byte as exactly two characters, giving the compact #RRGGBB notation.

Each hex digit equals exactly 4 binary bits. F = 1111, A = 1010, 0 = 0000. This makes conversion between hex and binary trivial.

The Hex Calculator uses standard validated formulas and provides results accurate to multiple decimal places. Review the step-by-step explanation to verify each calculation.