Simple Counter is now an Android app.Our Android app is here. Become a founding tester and try it before anyone else.

Join the testers

Number converter · Free · No sign-up

Hex to Decimal Converter

Short answer

To convert hex to decimal, multiply each digit by its power of 16, with A to F worth 10 to 15, and add: FF is 15 x 16 + 15 = 255. #FF5733 is 16734003 as one number, or red 255, green 87 and blue 51 as a colour. Read as a signed byte, FF is -1.

Colours, addresses and bytes read for you.

16734003In binary: 111111110101011100110011.#FF5733 in hex =
  1. Number the places from the point: the first place left of the point is 16⁰ = 1, the next 16¹ = 16.
  2. F (15) × 16⁵ = 15728640
  3. F (15) × 16⁴ = 983040
  4. 5 × 16³ = 20480
  5. 7 × 16² = 1792
  6. 3 × 16¹ = 48
  7. 3 × 16⁰ = 3
  8. Add them: 15728640 + 983040 + 20480 + 1792 + 48 + 3 = 16734003.
  9. As a colour, each pair of hex digits is one channel from 0 to 255: FF = 255, 57 = 87, 33 = 51.
The number in every common base, and as a colour
FormValue
Binary (base 2)111111110101011100110011
Octal (base 8)77653463
Decimal (base 10)16734003
Hexadecimal (base 16)FF5733
Binary in groups of four1111 1111 0101 0111 0011 0011
Read as a CSS colourrgb(255 87 51)
Red, green, blueFF = 255, 57 = 87, 33 = 51

The figures above are an example: put in your own hex number, colour code or address. Spaces and underscores between digit groups are ignored, and 0b, 0o, 0x or # in front are read when they match the base. Worked out exactly in this browser and kept there; nothing is sent anywhere. Going the other way? Use decimal to hex.

Type a hex number, with 0x or # in front if you like, and read its decimal value with every digit's share listed. A colour code is also split into its red, green and blue channels, and a bit width reads it as signed.

Hex to decimal conversion turns a base-16 number, written with 0 to 9 and A to F, into the base-10 number it stands for, by adding each digit times its power of 16.

  • No sign-up
  • Nothing uploaded
  • Shows every step
  • Works offline
  • Exact, any size

Key facts

Hex to decimal converter at a glance
DetailAnswer
Method shownEach digit × its power of 16, then add
Example#FF5733 = 16,734,003; as a colour rgb(255 87 51)
Colour codes3, 4, 6 or 8 digits after #, by the CSS Color 4 rules
Signed8, 16, 32 or 64-bit two's complement: FF = −1 at 8 bits
SizeUp to 256 characters, exact
Where your numbers are keptThis browser only

How to convert hex to decimal by hand

Place values in powers of 16, as the converter lists them.

  1. Turn letters into numbers

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

  2. Write the place values

    From the right: 1, 16, 256, 4,096, 65,536.

  3. Multiply each digit by its place value

    For 3E8: 3 x 256, 14 x 16, 8 x 1.

  4. Add the results

    768 + 224 + 8 = 1,000.

  5. For a colour, take the pairs one at a time

    #FF5733: FF = 255, 57 = 87, 33 = 51.

  6. For a signed value, check the top bit

    If the first digit is 8 to F, subtract 2 to the power of the width.

Who converts hex to decimal

Anyone reading a value a machine or a standard printed in base 16.

  • Web designers

    A #RRGGBB code into the RGB numbers a tool asks for.

  • Programmers and debuggers

    Addresses, offsets and error codes as decimal.

  • Students

    Base-16 exercises with every step shown.

  • Network engineers

    Fields in a packet dump read as numbers.

  • Game modders

    Values found in a hex editor turned into real numbers.

  • Electronics hobbyists

    Register values from a datasheet read as decimal.

Reading a hex colour code

A hex colour code is three (or four) numbers side by side, not one. Type it with its # and the converter reads it both ways: as one number, and channel by channel as a CSS colour. The rules come from the W3C CSS Color Module Level 4: six digits are red, green and blue pairs; three digits are a shorthand in which each digit is doubled, so #123 is #112233; and eight or four digits add an alpha channel, where 00 is fully transparent and ff fully opaque.

Reading hex colour codes
CodeChannels in decimalAs CSS rgb()Note
#FF5733255, 87, 51rgb(255 87 51)Six digits: one pair a channel
#F53255, 85, 51rgb(255 85 51)Three digits: F is FF, 5 is 55, 3 is 33
#0000FFCC0, 0, 255, alpha 204rgb(0 0 255 / 80%)Eight digits: CC is 204 of 255
#1122338017, 34, 51, alpha 128rgb(17 34 51 / 50.2%)80 is 128, just over half
#808080128, 128, 128rgb(128 128 128)Equal channels: a grey

Note that #F53 is not #FF5733: the shorthand doubles the 5 into 55 (85), not 57 (87). The converter also gives the whole code as one decimal number (#FF5733 is 16,734,003), which is how some programs and file formats store a colour, but for design work the three channel values are the ones you need. To go from decimal channels to a code, use the decimal to hex colour steps.

Memory addresses and sizes in decimal

Memory addresses, offsets and sizes are written in hex because each digit is four bits, so round binary sizes look round. Converting them to decimal tells you how big a region is or how far apart two addresses are.

Hex addresses and sizes in decimal
HexDecimalWhat it usually is
0x4001,0241 KiB
0x10004,096A 4 KiB memory page
0xFFFF65,535The top of a 16-bit address space
0x1000065,53664 KiB
0x1000001,048,5761 MiB
0x7FFFFFFF2,147,483,647The largest signed 32-bit value
0xFFFFFFFF4,294,967,295The top of a 32-bit address space (4 GiB − 1)

KiB and MiB are the binary units, 1,024 and 1,048,576 bytes, which NIST’s page on binary prefixes records the IEC adopted in 1998 so that kB could keep meaning 1,000. Subtract two addresses in decimal to get a size in bytes, or turn on two’s complement to read an offset such as 0xFFFFFFF0 as −16.

Byte values: signed or unsigned

A single byte is two hex digits, 00 to FF. Whether 80 to FF are large positive numbers or negative ones depends on whether the byte is signed. Set the width to 8-bit to see the signed reading.

Byte values read unsigned and signed
HexUnsignedSigned (8-bit two’s complement)
0000
7F127127
80128−128
C8200−56
FE254−2
FF255−1

Spreadsheets apply the same idea at a fixed width: Excel’s HEX2DEC reads up to ten hex digits as a 40-bit signed number, so HEX2DEC("FFFFFFFFFF") is −1 while HEX2DEC("FF") is 255. This converter lets you choose 8, 16, 32 or 64 bits instead, or no sign at all.

Powers of 16

Each hex place is worth 16 times the one to its right. These are the values the converter multiplies by.

Powers of 16
Place from the rightPowerDecimal value
1st1601
2nd16116
3rd162256
4th1634,096
5th16465,536
6th1651,048,576
7th16616,777,216
8th167268,435,456
1st after the point16−10.0625

So 3E8 is 3 × 256 + 14 × 16 + 8 = 1,000. Hex fractions always end in decimal, because every power of 16 divides some power of 10: 0.8 in hex is exactly 0.5.

What this page does not do

This page converts hex numbers. It does not decode hex bytes into text, and it does not decode a float or double stored as hex. Colour reading covers the #RGB, #RGBA, #RRGGBB and #RRGGBBAA forms of CSS; it does not name colours or convert to HSL or CMYK, which the colour picker does.

A run of hex pairs from a log or a packet capture is often text; the hex to ASCII converter reads it back as characters and flags bytes that are not valid UTF-8.

What this page does and does not do
It doesIt does not
Hex numbers and fractions of any size to exact decimalTurn hex bytes into text
Colour codes as channels and CSS rgb()Name colours or convert to HSL or CMYK
Signed bytes and words at 8 to 64 bitsDecode float or double layouts

This converter or a typical one

This hex to decimal converter compared with a typical one
 This pageA typical one
Colour codes read as channelsYes, #RGB to #RRGGBBAARarely
Signed bytes and words8 to 64 bits, both readingsOften unsigned only
Each digit's place value shownYes, with the sumOften the answer only
Very long hex valuesExactRounded past 13 hex digits
Your numbers leave the browserNeverVaries

Frequently asked questions

How do you convert hex to decimal?

Multiply each hex digit by 16 raised to its position, counting from 0 at the right, and add. Letters count as 10 to 15. For 2AF: 2 x 256 + 10 x 16 + 15 x 1 = 512 + 160 + 15 = 687. The converter lists each digit's value and the sum.

What is FF in decimal?

FF is 255: 15 x 16 + 15. It is the largest value one byte can hold. As a signed 8-bit number the same byte is -1, because its top bit is set. Set the width to 8-bit to see both.

What does 0x in front of a number mean?

0x marks the digits after it as hexadecimal, a convention from the C language now used almost everywhere in programming. 0x10 is 16, not 10. The converter accepts 0x and also # for colour codes; neither changes the value. Some older languages use a trailing h instead, as in 10h.

How do I convert a hex colour to RGB?

Split the six digits into three pairs and convert each pair: #FF5733 is FF = 255 red, 57 = 87 green, 33 = 51 blue. A three-digit code doubles each digit first, so #F53 is #FF5533. Type the code with its # and the converter shows the channels and the CSS rgb() value.

What is 7FFFFFFF in decimal?

7FFFFFFF is 2,147,483,647, which is 2^31 - 1: the largest number a signed 32-bit integer can hold. One more, 80000000, is 2,147,483,648 unsigned but -2,147,483,648 as a signed 32-bit value, which is where an overflowing signed counter wraps round to the bottom.

How do I convert hex to decimal in Excel?

Use =HEX2DEC("FF"), which gives 255. Excel accepts at most ten hex digits and treats them as a 40-bit signed number, so HEX2DEC("FFFFFFFFFF") is -1. For longer values, or another width, use this converter, which has no length limit short of 256 characters.

What is hex 10 in decimal?

Hex 10 is 16 in decimal: one sixteen and no ones. In the same way hex 100 is 256 and hex 1000 is 4,096. Writing 0x10, or setting the base in the converter, avoids reading it as ten. The same pattern runs through every base: 10 is always the base itself.

Why are memory addresses written in hex?

Because one hex digit is exactly four bits, an address in hex lines up with the bits the hardware uses, and sizes that are powers of 2 look round: a 4 KiB page is 0x1000. In decimal the same page is 4,096, and the bit pattern is hidden.

Open the hex to decimal converter

Free, no sign-up, and what you enter stays in your own browser.