Number converter · Free · No sign-up
Hex to Decimal Converter
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.
- Number the places from the point: the first place left of the point is 16⁰ = 1, the next 16¹ = 16.
- F (15) × 16⁵ = 15728640
- F (15) × 16⁴ = 983040
- 5 × 16³ = 20480
- 7 × 16² = 1792
- 3 × 16¹ = 48
- 3 × 16⁰ = 3
- Add them: 15728640 + 983040 + 20480 + 1792 + 48 + 3 = 16734003.
- As a colour, each pair of hex digits is one channel from 0 to 255: FF = 255, 57 = 87, 33 = 51.
| Form | Value |
|---|---|
| Binary (base 2) | 111111110101011100110011 |
| Octal (base 8) | 77653463 |
| Decimal (base 10) | 16734003 |
| Hexadecimal (base 16) | FF5733 |
| Binary in groups of four | 1111 1111 0101 0111 0011 0011 |
| Read as a CSS colour | rgb(255 87 51) |
| Red, green, blue | FF = 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
| Detail | Answer |
|---|---|
| Method shown | Each digit × its power of 16, then add |
| Example | #FF5733 = 16,734,003; as a colour rgb(255 87 51) |
| Colour codes | 3, 4, 6 or 8 digits after #, by the CSS Color 4 rules |
| Signed | 8, 16, 32 or 64-bit two's complement: FF = −1 at 8 bits |
| Size | Up to 256 characters, exact |
| Where your numbers are kept | This browser only |
How to convert hex to decimal by hand
Place values in powers of 16, as the converter lists them.
Turn letters into numbers
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
Write the place values
From the right: 1, 16, 256, 4,096, 65,536.
Multiply each digit by its place value
For 3E8: 3 x 256, 14 x 16, 8 x 1.
Add the results
768 + 224 + 8 = 1,000.
For a colour, take the pairs one at a time
#FF5733: FF = 255, 57 = 87, 33 = 51.
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.
| Code | Channels in decimal | As CSS rgb() | Note |
|---|---|---|---|
| #FF5733 | 255, 87, 51 | rgb(255 87 51) | Six digits: one pair a channel |
| #F53 | 255, 85, 51 | rgb(255 85 51) | Three digits: F is FF, 5 is 55, 3 is 33 |
| #0000FFCC | 0, 0, 255, alpha 204 | rgb(0 0 255 / 80%) | Eight digits: CC is 204 of 255 |
| #11223380 | 17, 34, 51, alpha 128 | rgb(17 34 51 / 50.2%) | 80 is 128, just over half |
| #808080 | 128, 128, 128 | rgb(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 | Decimal | What it usually is |
|---|---|---|
| 0x400 | 1,024 | 1 KiB |
| 0x1000 | 4,096 | A 4 KiB memory page |
| 0xFFFF | 65,535 | The top of a 16-bit address space |
| 0x10000 | 65,536 | 64 KiB |
| 0x100000 | 1,048,576 | 1 MiB |
| 0x7FFFFFFF | 2,147,483,647 | The largest signed 32-bit value |
| 0xFFFFFFFF | 4,294,967,295 | The 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.
| Hex | Unsigned | Signed (8-bit two’s complement) |
|---|---|---|
| 00 | 0 | 0 |
| 7F | 127 | 127 |
| 80 | 128 | −128 |
| C8 | 200 | −56 |
| FE | 254 | −2 |
| FF | 255 | −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.
| Place from the right | Power | Decimal value |
|---|---|---|
| 1st | 160 | 1 |
| 2nd | 161 | 16 |
| 3rd | 162 | 256 |
| 4th | 163 | 4,096 |
| 5th | 164 | 65,536 |
| 6th | 165 | 1,048,576 |
| 7th | 166 | 16,777,216 |
| 8th | 167 | 268,435,456 |
| 1st after the point | 16−1 | 0.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.
| It does | It does not |
|---|---|
| Hex numbers and fractions of any size to exact decimal | Turn 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 bits | Decode float or double layouts |
This converter or a typical one
| This page | A typical one | |
|---|---|---|
| Colour codes read as channels | Yes, #RGB to #RRGGBBAA | Rarely |
| Signed bytes and words | 8 to 64 bits, both readings | Often unsigned only |
| Each digit's place value shown | Yes, with the sum | Often the answer only |
| Very long hex values | Exact | Rounded past 13 hex digits |
| Your numbers leave the browser | Never | Varies |
More converters
Every converter on the site runs in your browser, needs no sign-up, and sends nothing anywhere.
Numbers & code6
Binary, hex, octal and any base, number systems, and codes generated in the browser.
Password generator
Random characters or EFF-word passphrases from the browser's crypto, no modulo bias, exact entropy, nothing sent.
Open password generator →ASCII, hex, binary, decimal converter
Text and byte codes both ways in one box, UTF-8 beyond 127 shown byte by byte, control characters named, Base64.
Open ascii, hex, binary, decimal converter →Binary converter
Binary, octal, decimal, hex or any base 2 to 36, exact at any size, fractions and two's complement, with steps.
Open binary converter →Binary to decimal
Each bit times its power of 2, binary fractions after the point, and signed patterns read at 8 to 64 bits.
Open binary to decimal →Decimal to binary
Repeated division by 2 shown step by step, 0.1 as the repeating 0.0(0011), negatives in two's complement.
Open decimal to binary →Decimal to hex
Division by 16 with A to F named, RGB channels to a #RRGGBB code, and negatives as hex patterns.
Open decimal to hex →
All 34 converters, by category: Length (10) · Weight & mass (5) · Temperature (3) · Cooking (1) · Currency (1) · Numbers & code (7) · Text (2) · Images (3) · Dates & time (2)
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.
Related guides
Longer answers to the questions behind the numbers.
- Reference
Types of counters explained
Synchronous vs asynchronous, mod-N, ring and Johnson, industrial and PLC counters, plus mechanical and software counters.
- Tallying
Tally marks in Excel and Google Sheets
The REPT, INT and MOD formula for five-bar gates, tested on every count from 0 to 120; a tally chart from raw answers with COUNTIF; and why LEN miscounts typed tallies.
- Tallying
Tally marks explained
Groups of five, the five-bar gate, and why the convention has survived for centuries.
- Counting
Count to 1,023 on your fingers
The value of each of ten fingers, worked examples, how to count up, and why the top is 1,023.
- Counting
Why word counts differ between tools
The same sentence is 26 words to one counter and 39 to another. Four counting rules side by side, and how to meet a hard limit whichever one a form uses.