Hex to decimal and decimal to hex converter
Hex to decimal: multiply each digit by a power of 16 and add, so FF (hex) = 255 (decimal) and 2A3 (hex) = 675 (decimal). Type a hex number (with or without 0x or #) and the decimal value appears as you type, with binary and octal underneath; decimal to hex works in the same box.
Source: Wikipedia: Positional notation (base conversion, place values). Updated: .
How it is calculated
How to convert hex to decimal
Every hex digit stands for 0 to 15 (A = 10, B = 11, C = 12, D = 13, E = 14, F = 15), and each place is worth 16 times the one to its right. Take 2A3: 2 × 16² + 10 × 16 + 3 = 512 + 160 + 3 = 675. For two digits there is a shortcut: first digit × 16 plus second digit, so B7 is 11 × 16 + 7 = 183. The working under the answer lists the place values for your own number.
From decimal back to hex
Divide by 16 again and again and read the remainders from the bottom: 255 ÷ 16 = 15 remainder 15, and 15 ÷ 16 = 0 remainder 15, so both digits are F: 255 (decimal) = FF (hex). Likewise 4,096 is 4096 (decimal) = 1000 (hex), one digit longer than 4,095, which is FFF. Remainders of 10 to 15 are written A to F.
Where hex values show up
- Colors: a web color such as #FF8800 is three bytes. FF = 255 red, 88 = 136 green, 00 = 0 blue, so it is rgb(255, 136, 0), a strong orange. Half brightness 80 is 128.
- Text: ASCII “A” is 0x41 = 65, lower-case “a” is 0x61 = 97, and the emoji U+1F600 is 128512.
- Memory sizes and limits: FFFF is 65535, the largest 16-bit value, and FFFFFFFF is 4294967295, the largest 32-bit one.
Why hex at all
One hex digit is exactly four bits (a nibble), so two digits make a byte and the number is a compact spelling of the binary: 0xFF = 1111 1111. That is why it is used for colors, memory addresses and byte dumps. The zero-x prefix (0x) only marks the notation: 0x10 is 16, not ten. Upper- and lower-case letters mean the same.
Very large values
The conversion is exact for long numbers, far beyond 53 bits where a calculator starts to round: FFFFFFFFFFFFFFFF (16 F's) comes out as 18446744073709551615. For negative numbers, other bases and two’s complement see the number base converter; for binary specifically see binary to decimal.
Frequently asked questions
How do I convert hex to decimal?
Multiply each digit by 16 raised to its place number (counting from 0 on the right) and add. For 2A3: 2 × 256 + 10 × 16 + 3 = 675, so 2A3 (hex) = 675 (decimal).
What is FF in decimal?
FF (hex) = 255 (decimal), the largest value of one byte. FFFF is 65535.
How do I convert decimal to hex?
Divide by 16 repeatedly and write the remainders (10 to 15 as A to F) from last to first. For 255: 255 (decimal) = FF (hex).
What does the 0x in front of a hex number mean?
It only says the digits are hexadecimal. 0x1F is the same as 1F, which is 31 in decimal. The converter accepts the prefix and a leading # as well.
How do I read a hex color code in decimal?
Split it into three pairs: #FF8800 is FF, 88, 00, which is red 255, green 136, blue 0.
Sources and legal basis
- Wikipedia: Positional notation (base conversion, place values)
- Unicode Standard – code points are written in hexadecimal (U+0041 = 65)
As of: · Editorial policy
Related tools
- Number base converter with stepsConvert between binary, octal, decimal, hex and any base from 2 to 36 – with full working, fractions, repeating digits and two’s complement (8–64 bit).
- Binary to decimal and decimal to binary converterBinary to decimal: add the powers of 2 where there is a 1, so 1011 = 11. Type bits for decimal, hex and octal, or go back from decimal, with the working.
- Binary Calculator with StepsBinary calculator online: add, subtract, multiply, divide and combine binary numbers with AND, OR, XOR – result also in decimal, hex and two’s complement.
- Color converter: HEX, RGB, HSL, HSV, CMYKConvert color codes: HEX to RGB, RGB to HEX, HSL, HSV, HWB and CMYK – type any format or use the color picker and copy the result, right in your browser.
- ASCII table with decimal, hex, octal, binary and Unicode lookupASCII table 0–127 plus Latin-1 and Windows-1252: decimal, hex, octal, binary, HTML entity, control codes. Search it, click to copy, convert text to codes.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- Attendance percentage calculatorAttendance percentage calculator for school and college: enter classes held and attended, and see how many you can miss or must attend to reach 75%.
- GWA Calculator (General Weighted Average)GWA calculator for college in the Philippines: enter each subject’s grade and units and get your general weighted average with the full computation.
- UCAS points calculatorUCAS points calculator: type your grades – A levels, AS, EPQ, BTEC, T Levels, Highers – and get your total UCAS Tariff points with the points for each one.