Hex to Decimal Converter

Convert hex to decimal with step-by-step working. Shows the binary equivalent, accepts 0x prefix input, and handles signed values.

Hexadecimal (base 16) uses digits 0-9 and letters A-F to represent values compactly. This converter provides instant bidirectional conversion between hex, decimal, and binary. Enter a hex value (with or without the 0x prefix) or a decimal number, and all formats update as you type. The tool uses JavaScript BigInt internally, so it handles arbitrarily large values without precision loss. Everything runs in your browser.

Ad
Ad

About Hex to Decimal Converter

Hex Digit Values

The hexadecimal system extends the familiar decimal digits (0-9) with six additional symbols (A-F) to represent values 10 through 15 in a single character. This gives each position 16 possible values instead of the 10 used in everyday counting. The table below shows all 16 hex digits alongside their decimal and 4-bit binary equivalents.

HexDecimalBinaryHexDecimalBinary
000000881000
110001991001
220010A101010
330011B111011
440100C121100
550101D131101
660110E141110
770111F151111

The key relationship here is that each hex digit maps to exactly 4 binary bits (a nibble). Two hex digits represent a full byte (8 bits), covering the range 00 to FF (0 to 255 decimal). This one-to-four mapping is the main reason hex became the standard shorthand for binary data in computing.

How Hex to Decimal Conversion Works

Each hex digit represents a power of 16 based on its position from right to left. The rightmost digit is multiplied by 16^0 (which is 1), the next by 16^1 (16), then 16^2 (256), and so on. Multiply each digit by its positional value and sum the results.

Worked example - converting 1A3 hex to decimal: Start from the right. The digit 3 is in position 0, so 3 x 16^0 = 3 x 1 = 3. The digit A (value 10) is in position 1, so 10 x 16^1 = 10 x 16 = 160. The digit 1 is in position 2, so 1 x 16^2 = 1 x 256 = 256. Adding them up: 256 + 160 + 3 = 419. So hex 1A3 = 419 decimal.

Hex ValueCalculationDecimal Result
FF(15 x 16) + (15 x 1)255
1A3(1 x 256) + (10 x 16) + (3 x 1)419
BEEF(11 x 4096) + (14 x 256) + (14 x 16) + (15 x 1)48,879
DEAD(13 x 4096) + (14 x 256) + (10 x 16) + (13 x 1)57,005

How Decimal to Hex Conversion Works

The reverse process uses repeated division. Divide the decimal number by 16, write down the remainder, and repeat with the quotient until it reaches zero. Each remainder becomes a hex digit, and reading them from bottom to top gives the final hex string. Remainders of 10 through 15 are written as A through F.

Worked example - converting 1000 decimal to hex: 1000 / 16 = 62 remainder 8. 62 / 16 = 3 remainder 14 (E). 3 / 16 = 0 remainder 3. Reading remainders bottom to top: 3E8. So 1000 decimal = 3E8 hex. You can verify: (3 x 256) + (14 x 16) + (8 x 1) = 768 + 224 + 8 = 1000.

StepDivisionQuotientRemainderHex Digit
11000 / 166288
262 / 16314E
33 / 16033

Reading remainders bottom to top: 1000 decimal = 3E8 hex.

Why Hex Became the Standard in Computing

The hexadecimal notation used today (digits 0-9 plus letters A-F) was standardised by IBM in 1963 and became the de facto convention by 1966 through the Fortran IV manual for the IBM System/360 (Wikipedia). Before that, some systems used alternative notations - the Bendix G-15 computer used 0-9 and u-z back in 1956.

Hex won out for a practical reason: modern computers organise data in bytes (8 bits), and one byte maps perfectly to two hex digits. A 32-bit memory address fits in 8 hex digits (like 0x7FFE1234), while the same address in binary would be 32 characters long. Octal (base 8) was popular on older systems with 12-bit or 36-bit word sizes, but since most modern architectures use word sizes that are multiples of 4 bits, hex is a natural fit.

Hex also has a simple relationship with binary: to convert, just group the binary digits into sets of four from the right and translate each group independently. Converting 1101 1010 in binary gives DA in hex - no arithmetic needed, just a lookup. This is why debuggers, hex editors, and memory dump tools all default to hexadecimal.

Where Hex Is Used

ContextExampleWhy Hex
CSS colour codes#FF5733Two hex digits per colour channel (0-255 maps to 00-FF)
Memory addresses0x7FFE1234Compact representation of 32 or 64-bit binary addresses
MAC addressesA1:B2:C3:D4:E5:F66 bytes as 12 hex characters
Unicode code pointsU+1F600 (grinning face emoji)Standard notation for character encoding
Error codes0x80070005 (Access Denied)Windows HRESULT codes are hex by convention
File magic bytes89 50 4E 47 (PNG header)Binary file signatures displayed as hex
IPv6 addresses2001:0db8::1128 bits as 8 groups of 4 hex digits

In web development, hex is everywhere. CSS colour codes like #FF5733 encode red, green, and blue channels as three pairs of hex digits - FF for 255 red, 57 for 87 green, and 33 for 51 blue. The Colour Converter can translate between HEX, RGB, HSL, and other formats if you need to work with colours directly.

Network protocols rely heavily on hex too. MAC addresses use 6 bytes written as 12 hex characters (separated by colons or hyphens). IPv6 addresses represent 128 bits as eight groups of four hex digits. Even the file sitting on your disk identifies itself with hex magic bytes at the start - a PNG image always begins with 89 50 4E 47 0D 0A 1A 0A, and a PDF starts with 25 50 44 46 (the ASCII hex for "%PDF").

Common Hex Values Worth Knowing

HexDecimalSignificance
0x000Null byte - string terminator in C
0xFF255Maximum value of a single byte (8 bits)
0xFFFF65,535Maximum value of a 16-bit unsigned integer
0x7FFFFFFF2,147,483,647Maximum 32-bit signed integer (INT_MAX)
0xFFFFFFFF4,294,967,295Maximum 32-bit unsigned integer (UINT_MAX)
0x1FFFFFFFFFFFFF9,007,199,254,740,991JavaScript Number.MAX_SAFE_INTEGER (2^53 - 1)
0x2032ASCII space character
0x4165ASCII uppercase 'A'
0x6197ASCII lowercase 'a'
0x3048ASCII digit '0'

The byte boundaries are the ones you will hit most often. 0xFF (255) is the largest value a single byte can hold, which is why RGB colour channels max out at 255. 0x7FFFFFFF (about 2.1 billion) is the classic INT_MAX in 32-bit signed systems - go one higher and you wrap into negative numbers in languages like C or Java. In JavaScript, the safe integer limit is 0x1FFFFFFFFFFFFF (roughly 9 quadrillion), beyond which standard Number loses precision. This tool uses BigInt internally, so it handles values well past that limit.

Hex and ASCII Characters

The ASCII standard (defined by ANSI X3.4-1986) assigns each character a number from 0 to 127, and those numbers are commonly written in hex. Printable characters span from 0x20 (space) to 0x7E (tilde). The uppercase letters A-Z sit at 0x41 through 0x5A, lowercase a-z at 0x61 through 0x7A, and digits 0-9 at 0x30 through 0x39. One handy pattern: the difference between uppercase and lowercase is always 0x20 (32 decimal), so toggling bit 5 flips the case of any letter.

Character RangeHex RangeDecimal RangeCount
Control characters0x00 - 0x1F0 - 3132
Space and punctuation0x20 - 0x2F32 - 4716
Digits 0-90x30 - 0x3948 - 5710
Uppercase A-Z0x41 - 0x5A65 - 9026
Lowercase a-z0x61 - 0x7A97 - 12226
DEL0x7F1271

For a full interactive reference, the ASCII Table tool shows every character with its decimal, hex, binary, and octal values.

Hex in Colour Codes

Hex CodeRGBColour
#FF000025500Red
#00FF0002550Green
#0000FF00255Blue
#FFFFFF255255255White
#000000000Black
#808080128128128Medium grey

Each pair of hex digits in a CSS colour code represents one colour channel (red, green, blue), with 00 being none and FF being full intensity. CSS also supports shorthand hex - #F00 expands to #FF0000, and 8-digit hex codes like #FF573380 add an alpha (transparency) channel as the last two digits. The Colour Converter translates between HEX, RGB, HSL, and more formats.

Common Mistakes When Working with Hex

Forgetting that hex is case-insensitive trips people up occasionally. 0xFF, 0xff, and 0xFf all mean the same thing - 255 decimal. Most style guides prefer uppercase (FF) for data and colour codes, but language conventions vary. Python uses lowercase (0xff), while CSS historically uses uppercase (#FF5733).

Another common mistake is confusing the 0x prefix with the value itself. The "0x" is just a notation convention used in programming languages like C, Java, JavaScript, and Python to indicate that the following characters are hexadecimal. The actual value is only the part after the prefix - 0xFF and FF represent the same number.

Precision is a real pitfall when converting large hex values in JavaScript. The standard Number type only safely handles integers up to 2^53 - 1 (hex 0x1FFFFFFFFFFFFF). Anything larger, like a 64-bit memory address, will silently lose precision if you use parseInt(). The correct approach for large values is BigInt, which is what this tool uses internally.

Negative numbers also cause confusion. Hex itself has no sign, but signed integer representations use two's complement. In a 32-bit signed system, 0xFFFFFFFF is not 4,294,967,295 - it is -1. Whether a hex value is treated as signed or unsigned depends on the programming context and the data type being used.

For binary-specific work with bit visualisation, the Binary to Decimal Converter focuses on that use case. For converting between any base from 2 to 36, the Number Base Converter handles all bases simultaneously. All conversions run in your browser with no data sent to any server.

Sources

Frequently Asked Questions

How do you convert hexadecimal to decimal?

Each hex digit represents a power of 16 based on its position from right to left. Multiply each digit by its positional power of 16 and add the results. For example, hex 1A3 equals (1 x 256) + (10 x 16) + (3 x 1) = 419 in decimal. Letters A through F represent values 10 through 15.

How do you convert decimal to hexadecimal?

Repeatedly divide the decimal number by 16 and record the remainder at each step. Remainders of 10 through 15 are written as A through F. Read the remainders from bottom to top to form the hex string. For example, 255 in hex is FF.

Does the tool accept the 0x prefix?

Yes. You can enter hex values with or without the 0x prefix. The tool automatically strips the prefix before converting, so both "FF" and "0xFF" produce the same result.

What is the relationship between hexadecimal and binary?

Each hexadecimal digit maps to exactly four binary digits (bits). For example, hex F equals binary 1111 and hex A equals binary 1010. This one-to-four mapping makes hex a compact way to represent binary data, which is why it is widely used in programming and digital systems.

What are common uses of hexadecimal numbers?

Hexadecimal is used extensively in programming for memory addresses, color codes (like

Link to this tool

Copy this HTML to link to this tool from your website or blog.

<a href="https://toolboxkit.io/tools/hex-to-decimal-converter/" title="Hex to Decimal Converter - Free Online Tool">Try Hex to Decimal Converter on ToolboxKit.io</a>