To convert hex to decimal, multiply each digit by a power of 16 and add: 1A3 = 1×256 + 10×16 + 3 = 419. Digits A–F stand for 10–15, so FF = 255 and FFFF = 65,535. To go from decimal to hex, divide by 16 repeatedly and read the remainders from the bottom up. Each hex digit is exactly 4 binary bits. Subnet masks follow the same pattern: 255.255.255.0 is FF.FF.FF.00, which the IP subnet calculator works out from a /24 prefix.
This hex calculator converts between hexadecimal and decimal. Default mode is hex to decimal with value FF, which equals 255. Switch modes when you need the reverse direction.
Developers and students use it while reading color codes, memory dumps, and bit masks. For binary string work on the same theme, use the binary calculator. For percent math beside coding homework, use the percentage calculator.
How the formula works
Hex to decimal parses the string in base 16. Decimal to hex formats a non-negative integer in base 16. Digits above 9 use letters A through F.
Worked example
FF hex means 15×16 + 15 = 255 decimal.
| Input | Value |
|---|---|
| Mode | Hex to decimal |
| Value | FF |
| Result | 255 |
How to use the fields
- Value is the hex string or decimal number depending on mode.
- Convert chooses hex to decimal or decimal to hex.
Place values
Each hex digit is a power of 16. Two digit values like FF sit in the 0 to 255 range common in byte sized RGB channels.
Hex, decimal and binary reference
| Hex | Decimal | Binary | Note |
|---|---|---|---|
| FF | 255 | 1111 1111 | Largest 1-byte value |
| 1A3 | 419 | 1 1010 0011 | Worked example |
| 1000 | 4,096 | 1 0000 0000 0000 | 16³ |
| BEEF | 48,879 | 1011 1110 1110 1111 | |
| FFFF | 65,535 | 1111 1111 1111 1111 | Largest 16-bit value |
| FFFFFFFF | 4,294,967,295 | 32 ones | Largest 32-bit unsigned |
| 1FFFFFFFFFFFFF | 9,007,199,254,740,991 | 53 ones | Largest safe integer in a plain JavaScript number (this tool uses BigInt, so it goes beyond it exactly) |
Hexadecimal Arithmetic: Add, Subtract and Multiply Hex
This hexadecimal calculator converts; it does not add or multiply. The reliable method is: convert each hex value to decimal, do the math, then switch to decimal to hex mode and convert the answer back. You can also work by hand in base 16, carrying 1 for every 16 instead of every 10.
Hex addition by hand: 1A3 + FF. Right column: 3 + F = 3 + 15 = 18 = 16 + 2, so write 2 and carry 1. Middle: A + F + 1 = 10 + 15 + 1 = 26 = 16 + 10, so write A and carry 1. Left: 1 + 1 = 2. Answer 2A2. Check in decimal: 419 + 255 = 674, and 674 converts to 2A2.
| Operation | Hex | Decimal check | Hex answer |
|---|---|---|---|
| Add | 1A3 + FF | 419 + 255 = 674 | 2A2 |
| Subtract | FF − 1A | 255 − 26 = 229 | E5 |
| Multiply by 10 hex | 1A × 10 | 26 × 16 = 416 | 1A0 |
| Multiply | C × C | 12 × 12 = 144 | 90 |
| Carry past FFFF | FFFF + 1 | 65,535 + 1 = 65,536 | 10000 |
Multiplying by 10 in hex shifts the digits one place left, just like multiplying by 10 in decimal, because 10 hex = 16.
Common mistakes
- Leaving mode on hex to decimal while typing a decimal like 255 without letters
- Using letters beyond F
- Expecting signed two’s complement formatting from this simple converter
- Forgetting that 10 hex is 16 decimal, not ten
Color codes
| Color code | R | G | B |
|---|---|---|---|
| #FFFFFF | 255 | 255 | 255 |
| #FF8800 | 255 | 136 | 0 |
| #1A7FC0 | 26 | 127 | 192 |
| #000000 | 0 | 0 | 0 |
Rule: split the 6 digits into 3 pairs and convert each pair (00–FF = 0–255).
Bytes and words
Two hex digits make one byte in the 00 to FF range. Four hex digits often represent 16 bit values. Knowing those widths helps when a dump pads with leading zeros.
This converter returns the numeric value without forcing a fixed width display.
For data rates, see the bandwidth calculator.
Case and prefixes
Languages may show 0xFF or hFF style prefixes. In hex to decimal mode this calculator accepts an optional 0x prefix (0xFF and FF both give 255). Strip other prefixes such as h or # first, and never type a prefix in decimal to hex mode.
Uppercase and lowercase letters are equal in value. Pick one style for team docs and stay consistent.
A 0x prefix is optional for hex input; other prefixes and spaces are not accepted.
Limitations
No bitwise operators, no floating hex formats, and no automatic bit width padding beyond what you type.
Results stay exact at any size, because the calculator uses whole-number BigInt math: FFFFFFFFFFFFFFFF (64 bits) converts to 18,446,744,073,709,551,615 with no rounding. For bigger numbers use the big number calculator, or see the scientific notation calculator for very large or small values. Negative numbers and two’s complement are not supported.