Online Calculators and Tools | Calculators Toolbox
This hex converter changes decimal to hexadecimal and hex back to decimal, with binary and octal shown too.
Our free hex converter changes decimal numbers into hexadecimal and hex values back into decimal, with every step explained. Each result also shows the binary and octal equivalents, making it handy for programming, web colors and networking.
Hexadecimal, or hex, is a base-16 number system. It uses sixteen symbols: the digits 0–9 for values zero to nine, and the letters A–F for ten to fifteen. So A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Each place in a hex number is worth 16 times the place to its right: ones, sixteens, 256s, 4,096s and so on.
Programmers love hex because it's a compact way to write binary. One hex digit represents exactly four bits, so a byte (8 bits) is always two hex digits, from 00 to FF. That's far easier to read than 11111111. You'll see hex in color codes like #FF5733, memory addresses, error codes, MAC addresses and encryption keys.
To go from decimal to hex, divide by 16 repeatedly and write the remainders as hex digits. To go from hex to decimal, multiply each digit by its power of 16 and add.
For BEEF: B (11) × 4,096 + E (14) × 256 + E (14) × 16 + F (15) × 1 = 45,056 + 3,584 + 224 + 15 = 48,879. And 48,879 ÷ 16 gives remainders F, E, E, B, which read upward spell BEEF again.
#1E90FF means red 1E (30), green 90 (144), blue FF (255), a bright "dodger blue".
Debuggers display addresses like 0x7FFE4A2C because hex is shorter and maps neatly onto binary.
Network cards have IDs such as 3C:22:FB:9A:01:7E, six bytes written as hex pairs.
IPv6 addresses like 2001:0db8::1 are written in hex groups of four digits.
Windows and other systems report errors as hex codes like 0x80070005 (access denied).
Characters are identified by hex code points: U+0041 is A, and U+1F600 is the grinning-face emoji.
Because base 16 needs sixteen symbols, the letters A–F stand for the values 10–15. Case doesn't matter: ff and FF are the same.
Every hex digit equals exactly four binary digits: 0 = 0000, 9 = 1001, A = 1010, F = 1111. To convert hex to binary, simply swap each digit for its four bits. See the full working with the binary converter.
Example: 3C = 0011 1100.
Hex numbers are often marked so they aren't confused with decimal: 0x in programming (0xFF), # in CSS colors (#FF0000), a subscript 16 in math (FF₁₆), or an h suffix in some assembly languages (FFh).
A six-digit color code is three bytes: #RRGGBB. Each pair ranges from 00 (none) to FF (full). #000000 is black, #FFFFFF is white and #FF0000 is pure red. Short codes like #F80 expand to #FF8800.
| Hex | Decimal | Binary | Hex | Decimal | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | A | 10 | 1010 |
| 3 | 3 | 0011 | B | 11 | 1011 |
| 4 | 4 | 0100 | C | 12 | 1100 |
| 5 | 5 | 0101 | D | 13 | 1101 |
| 6 | 6 | 0110 | E | 14 | 1110 |
| 7 | 7 | 0111 | F | 15 | 1111 |
Convert the decimal number 2,026 to hex.
Type 2026 into the hex converter and you'll get 7EA, plus the binary form 0111 1110 1010.
Web designers convert hex constantly, even if they don't think of it that way. Take the color #2575FC used in the calculator button above. Split it into pairs: 25, 75 and FC. In decimal those are 37, 117 and 252, so the color is rgb(37, 117, 252), a bright blue with a little red and green. Lighter colors have higher values in every pair; darker ones have lower values. Understanding hex lets you tweak colors by hand instead of reaching for a color picker every time.
Adding hex works like decimal but carries at 16 instead of 10: 9 + 7 = 16, which is written 10 in hex, and F + 1 = 10. Multiplying by 16 just adds a 0 on the right, so A becomes A0 (160). A handy shortcut for hex-to-binary is to memorize the 16 four-bit patterns in the table above; once you know them, you can convert any hex value to binary at sight, digit by digit, with no arithmetic at all.
A classic error is confusing the letter O with the digit 0, or the letter I with 1. Hex only uses the letters A to F, so if you see a G or an O, something has been mistyped. Another frequent slip is forgetting that A to F are worth 10 to 15, and treating hex 10 as ten rather than sixteen. When in doubt, convert the value back to decimal to double-check.
Our hex converter works in both directions with very large numbers, accepts 0x prefixes and lowercase letters, and shows binary and octal at the same time. The step-by-step explanation makes the math easy to follow. It's built for developers, web designers, network engineers and computer science students who need fast, accurate hex conversions.
Hexadecimal is a base-16 number system that uses the digits 0–9 and the letters A–F, where A to F stand for the values 10 to 15.
Multiply each hex digit by 16 raised to its position, starting from 0 on the right, and add the results. For 2F, that is 2 × 16 + 15 = 47.
Divide the number by 16 repeatedly and write each remainder as a hex digit. Read the remainders from the last to the first. 255 becomes FF.
FF in hexadecimal equals 255 in decimal. It is the largest value that fits in one byte.
Each hex digit represents exactly four binary digits, so hex is a short, readable way to write binary values such as memory addresses, colors and byte data.
The 0x prefix shows that a number is written in hexadecimal. For example, 0x1A means the hex number 1A, which is 26 in decimal.