Hexadecimal Calculator – Convert and Calculate in Base 16
Type a number in decimal, hex, binary or octal and see it in all four bases at once, or add, subtract and multiply two hex numbers and read the answer in hex and decimal. Exact even for very large values.
Your number
For hex, the 0x prefix is optional and A to F work in either case. A leading minus sign is allowed and means a negative value.
Your numbers never leave this page. Everything is calculated in your browser.
Result
The same number, four ways
In arithmetic mode the same panel shows the answer in hex and decimal, for example 1A plus 2B equals 45 in hex, which is 69 in decimal.
- Each hex position is worth a power of 16, with A to F standing for 10 to 15: FF is 255, and 1A3 is 419.
- One number is shown in all four bases at once, so the same value can be copied in decimal, hex, binary or octal.
- In hex arithmetic the answer reads in hex and decimal together: FF times 2 is 1FE, which is 510.
- How hex place value works, with 1A3
- How it works, in three steps
- Why base 16 exists at all
- One number, four spellings: the probed conversions
- Hex arithmetic: four probed sums, and the carry that makes a new digit
- Place value, digit by digit, and the binary shortcut
- Invalid input, negative numbers, and what this page does not do
- Hex where you already meet it: colours, bytes, and nibbles
- Hex in dumps, digests, and addresses: length first, value second
- Frequently asked questions
How hex place value works, with 1A3
Each position is worth a power of 16, starting from 16 to the power 0 on the right. Letters A to F stand for the values 10 to 15.
| Digit | Value | Place | Contribution |
|---|---|---|---|
| 1 | 1 | 16 squared = 256 | 256 |
| A | 10 | 16 to the power 1 = 16 | 160 |
| 3 | 3 | 16 to the power 0 = 1 | 3 |
| Total | 419 | ||
Common values to keep in mind: 0 is 0, 10 in hex is 16, 7F is 127, FF is 255, 100 in hex is 256, and 1A3 is 419.
Related tools
Conversion Calculator
Convert between everyday units of length, weight, volume and more.
%Percentage Calculator
Percent of a number, percent change and what percent one number is of another.
ƒxScientific Calculator
Powers, roots, logs and trigonometry in one place.
📖Hex to Decimal, Binary & Octal
Place value, the four-bit trick, and worked conversions.
How it works, in three steps
Pick a base and type a number
Choose hexadecimal, decimal, binary or octal, then type your number. For hex, 0x is optional and upper or lower case letters both work.
Read all four bases
The same value appears in decimal, hex, binary and octal at once, so you can copy whichever form you need.
Or do hex arithmetic
Switch to hex arithmetic, type two hex numbers, pick add, subtract or multiply, and read the answer in hex and decimal.
Why base 16 exists at all
Computers work in binary, but long binary strings are hard for people to read and easy to mistype. Hexadecimal is a compact shorthand for binary: every hex digit maps to exactly 4 bits, so a byte is always exactly two hex digits. That is why you see hex in color codes like #FF5733, in memory addresses, in network settings and in file formats. Converting is not guesswork, it is place value with 16 instead of 10: FF means 15 times 16 plus 15, which is 255, and 1A3 means 1 times 256 plus 10 times 16 plus 3, which is 419.
Start at the right. The rightmost digit counts ones, the next counts sixteens, the next counts 256s, and each step left multiplies the place by 16 again. Multiply each digit by its place and add the results. For 1A3 that gives 1 times 256, plus 10 times 16, plus 3, which is 419. Letters are just digits past 9: A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.
There is no single universal way to write a negative hex number, so this page uses the plainest one: a minus sign in front of the magnitude, for example -1A means negative 26. That is not two’s complement notation, where the same bits mean something different depending on the width you assume. If you need two’s complement for a fixed width, convert the magnitude here first and then apply your width rule separately.
One number, four spellings: the probed conversions
The default conversion is the one every hex learner meets first. Type FF in hexadecimal and the panel shows decimal 255, binary 11111111 (displayed grouped as 1111 1111), octal 377, 2 hex digits, and 8 bits, with the sentence: FF is 8 bits, because one hex digit holds exactly 4 bits. Every figure in this section was read from the calculator’s own displayed results for the stated inputs. Work backwards and it checks: F is 15, so FF means 15 times 16 plus 15, which is 255, and the base guide’s own check for 255 to hex is the reverse division, 255 divided by 16 is 15 remainder 15, and both remainders are 15, which is F, so decimal 255 is hex FF.
Change the base and the same value appears in all four spellings at once. Type 255 in decimal and the panel shows hex FF, decimal 255, binary 1111 1111, and octal 377 — the same four answers as typing FF, because it is the same number. Type 1010 in binary and the panel shows hex A, decimal 10, binary 1010, and octal 12, with 1 hex digit and 4 bits: 1010 in binary is 8 + 2 = 10, and 10 in hex is the single digit A. Type 777 in octal and the panel shows hex 1FF, decimal 511, binary 111111111 (grouped 1 1111 1111), and octal 777, with 3 hex digits and 12 bits: 7 times 64 plus 7 times 8 plus 7 is 448 + 56 + 7 = 511, and 511 in hex is 1FF, because 1 times 256 plus 15 times 16 plus 15 is 256 + 240 + 15 = 511.
| Typed | Hexadecimal | Decimal | Binary | Octal | Digits / bits |
|---|---|---|---|---|---|
| FF (hex) | FF | 255 | 11111111 | 377 | 2 digits, 8 bits |
| 255 (decimal) | FF | 255 | 1111 1111 | 377 | 2 digits, 8 bits |
| 1010 (binary) | A | 10 | 1010 | 12 | 1 digit, 4 bits |
| 777 (octal) | 1FF | 511 | 111111111 | 777 | 3 digits, 12 bits |
| −1A (hex) | −1A | −26 | −11010 | −32 | 2 digits, 8 bits |
| FFFFFFFFFFFFFFFF (hex) | FFFFFFFFFFFFFFFF | 18,446,744,073,709,551,615 | 64 ones | 1,777,777,777,777,777,777,777 | 16 digits, 64 bits |
The last two rows need their own notes. A leading minus sign means a negative value written as minus followed by the magnitude: −1A means negative 26, shown as decimal −26, binary −11010, and octal −32, with 2 digits and 8 bits counted on the magnitude. That is not two’s complement notation, where the same bits mean something different depending on the width you assume, as the base guide warns — if you need two’s complement for a fixed width, convert the magnitude here first and then apply your width rule separately. And the very large row is the exactness proof: sixteen F’s convert to 18,446,744,073,709,551,615 in decimal, with 16 hex digits and 64 bits, computed by exact integer arithmetic with no floating-point rounding, as the base guide promises. There is no fixed size limit in the calculator itself, only what your browser can display.
Hex arithmetic: four probed sums, and the carry that makes a new digit
Switch to the hex arithmetic tab and the panel answers in hex and decimal together. The default arithmetic example, 1A plus 2B, equals 45 in hex, which is 69 in decimal: 26 + 43 = 69, and 69 in hex is 4 times 16 plus 5, which is 45. Every figure in this section was read from the calculator’s own displayed results for the stated inputs, with the arithmetic tab selected. Subtraction goes negative in the same plain way as conversion: 1A minus 2B equals −11 in hex, which is −17 in decimal, because 26 − 43 = −17, and −17 in hex is minus 11, since 1 times 16 plus 1 is 17. Multiplication is exact for large values too: FF times 2 equals 1FE in hex, which is 510 in decimal, because 255 × 2 = 510, and 510 in hex is 1 times 256 plus 15 times 16 plus 14, which is 256 + 240 + 14 = 510.
The most instructive sum is the smallest one: FF plus 1 equals 100 in hex, which is 256 in decimal. In decimal, 99 + 1 = 100 carries into a new digit; in hex, FF + 1 = 100 carries the same way, because F is the largest single hex digit, just as 9 is the largest single decimal digit. That carry is the whole reason the base guide’s common values list reads the way it does: 0 is 0, 10 in hex is 16, 7F is 127, FF is 255, 100 in hex is 256, and 1A3 is 419. Each of those landmarks is a carry boundary or a digit boundary, and misreading 10 in hex as ten, instead of sixteen, is the single most common hex mistake — the panel’s decimal answer beside every hex answer exists to catch exactly that slip.
Two input habits are worth confirming, because both were probed. Lowercase letters work and are normalised to uppercase in the display: typing ff in hex shows hex FF, decimal 255, binary 1111 1111, and octal 377, exactly as typing FF does, because the base guide states that A to F work in either case. Leading zeros are likewise harmless and are dropped in the display: typing 00FF shows hex FF with 2 digits and 8 bits, not 4 digits, because the value is 255 and the zeros contribute nothing. The 0x prefix is optional, as the base guide states: it is just a label that says the digits that follow are hexadecimal, common in programming and in colour codes, and FF and 0xFF mean the same value here.
Place value, digit by digit, and the binary shortcut
Converting is not guesswork, it is place value with 16 instead of 10, as the base guide says, and the page’s own table for 1A3 is the model. Each position is worth a power of 16, starting from 16 to the power 0 on the right: the digit 1 is worth 1, at place 16 squared = 256, contributing 256; the digit A is worth 10, at place 16 to the power 1 = 16, contributing 160; the digit 3 is worth 3, at place 16 to the power 0 = 1, contributing 3; and 256 + 160 + 3 = 419. Start at the right, as the base guide advises: the rightmost digit counts ones, the next counts sixteens, the next counts 256s, and each step left multiplies the place by 16 again. Letters are just digits past 9: A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15.
The reverse direction, decimal to hex, is division with remainders, and the base guide’s 255 example is the model: 255 divided by 16 is 15 remainder 15, and both remainders are 15, which is F, so decimal 255 is hex FF. For a larger number, repeat: divide by 16, keep the remainder as the next hex digit from the right, and divide the quotient again until the quotient is zero. The panel does this for you, but knowing the method lets you check a single digit by hand: for 511, 511 divided by 16 is 31 remainder 15 (F), 31 divided by 16 is 1 remainder 15 (F), and 1 divided by 16 is 0 remainder 1, giving 1FF from the last remainder backwards — which matches the panel’s octal-777 conversion exactly.
The binary shortcut is why base 16 exists at all. Computers work in binary, but long binary strings are hard for people to read and easy to mistype, and hexadecimal is a compact shorthand for binary: every hex digit maps to exactly 4 bits, because 16 is 2 to the power 4, and four binary digits can hold exactly 16 different values, from 0000 to 1111, which is exactly the range of one hex digit, from 0 to F. That is why a byte, which is 8 bits, is always exactly two hex digits, and why you see hex in colour codes like #FF5733, in memory addresses, in network settings, and in file formats, as the base guide notes. To convert binary to hex by hand, group the binary digits in fours from the right and read each group as one hex digit: 1111 1111 groups as F F, and 1 1111 1111 groups as 1 F F, which is the panel’s grouping for 511.
Invalid input, negative numbers, and what this page does not do
Invalid input on this page fails quietly rather than loudly, and it is worth knowing the behaviour before you trust a result you did not expect. In probes of the page, typing G in hexadecimal mode left the panel showing the previous valid result, FF with decimal 255, rather than an error or a zero; typing 2 in binary mode, where only 0 and 1 are valid, did the same, leaving the previous FF result unchanged. The pattern matches the factorial page’s negative-input behaviour in this batch: an entry the page cannot interpret does not produce a new result, and the display keeps the last valid answer. So if the panel does not change after you type, do not read the old answer as the answer to your new input — check that every digit is valid for the base you selected, and re-enter it.
Negative numbers follow the plainest convention, and the base guide is explicit about its limits. A leading minus sign means a negative value, written as minus followed by the magnitude: −1A means negative 26. That is not two’s complement notation, because that meaning depends on a fixed bit width that you would have to choose separately, and this page does not ask you for a width. For programming or hardware work where bit width matters, the base guide’s closing advice applies: check the convention your platform uses, convert the magnitude here first, and then apply your width rule separately. The same caution covers the digit and bit counts for negative values, which are counted on the magnitude: −1A shows 2 digits and 8 bits, the same as 1A, because the minus sign is not a digit and carries no bits of its own.
Finally, what this page does not do is as useful as what it does. It converts and calculates in base 16, base 10, base 2, and base 8, and its arithmetic mode adds, subtracts, and multiplies two hex numbers — it does not divide, it does not convert fractions or decimals with fractional parts, and it does not apply two’s complement, fixed-width, or floating-point conventions. The base guide’s closing note states the scope plainly: this is a general-purpose math tool, negative hex values here use a minus sign in front of the magnitude, not two’s complement notation, and for programming or hardware work where bit width matters, check the convention your platform uses. Within that scope, the arithmetic is exact even for very large values, because all math on this page uses exact integer arithmetic rather than floating point.
Hex where you already meet it: colours, bytes, and nibbles
The most common place most readers meet hexadecimal is the colour code, and it is a perfect hex exercise because it is three small conversions in one string. Take the base guide’s example, #FF5733. Drop the # label, split the six hex digits into three pairs — FF, 57, and 33 — and convert each pair: FF is 15 times 16 plus 15, which is 255, for red; 57 is 5 times 16 plus 7, which is 87, for green; and 33 is 3 times 16 plus 3, which is 51, for blue. So #FF5733 means red 255, green 87, blue 51, each on the usual 0-to-255 scale, and the reason each colour channel is exactly two hex digits is the same reason a byte is exactly two hex digits: a channel holds 8 bits, and one hex digit holds exactly 4 bits, so two digits hold the whole channel with nothing left over. White, #FFFFFF, is 255 for all three channels; black, #000000, is 0 for all three; and any colour you can name on a screen is three bytes written as six hex digits.
The same grouping explains the word nibble, which is the standard name for a single hex digit’s worth of bits: a nibble is 4 bits, half a byte, and one hex digit. Two nibbles make a byte, four nibbles make a 16-bit word, and sixteen nibbles make the 64-bit value in the conversion table above — sixteen F’s, 64 bits, decimal 18,446,744,073,709,551,615. When programmers say a value is “two bytes”, they mean four hex digits; when they say a memory address is written in hex, they mean the long binary address has been grouped in fours so a human can read it and copy it without dropping a digit. The grouping is the whole point: hex does not change the value, it changes the readability, and every conversion on this page is a change of spelling, not a change of number.
Two reading habits follow from that. First, when you see a long hex string, read it in pairs from the left for bytes, or in fours from the right for bit groups, and check the length before the value: a colour code with five digits or seven digits is malformed before any conversion begins, and a byte written as a single digit has a missing leading zero, not a different value. Second, when a hex value surprises you — a colour that renders wrong, an address that points nowhere — convert it back to decimal and check the magnitude first, because the most common hex errors are magnitude errors: reading 10 as ten instead of sixteen, dropping a leading digit, or confusing a hex pair with a decimal pair. The panel’s four-way display exists for exactly that check: one value, four spellings, and any spelling that disagrees with the other three is the one to distrust.
Hex in dumps, digests, and addresses: length first, value second
Outside colour codes, the hex strings most readers meet are memory dumps, file digests, and addresses, and the length-first habit matters even more there, because the strings are longer and the eye skips digits. A digest or checksum is a fixed-length hex string, and its length in hex digits is its bit length divided by four: a 128-bit digest is 32 hex digits, a 256-bit digest is 64 hex digits, and a digest that is shorter than its expected length has been truncated or mistyped before any comparison begins. Comparing two digests character by character is the whole point of the format — a single differing digit means a different file — so copy digests rather than retyping them, and let the calculator’s conversion confirm the magnitude if a digest’s leading digits look wrong: leading zeros in a digest are significant for length even though they do not change the value, which is the opposite of this calculator’s display rule, where 00FF is shown as FF because the value is what matters here.
Addresses follow the same length discipline with a different convention: an address is usually written with a fixed width, leading zeros included, so that addresses line up in a column and sort correctly as text. That is a display convention for alignment, not a value rule — the address with its leading zeros and the same address without them denote the same location, just as 00FF and FF denote the same value on this page — but stripping the zeros from an address before comparing it with a list will break the comparison even though the value is unchanged. When you move between this calculator and an address list, keep the width the list uses, and use the calculator for the value, not for the formatting: convert here, then re-pad to the list’s width by hand. And when a dump shows a byte as a single digit rather than a pair, treat it as a formatting choice of the dump, not as a half byte: every byte is two hex digits, and a lone digit is a digit waiting for its partner.
The three primary colours are the quickest self-test of the colour-code method, because each one isolates a single channel. Pure red is #FF0000: red FF is 255, green 00 is 0, and blue 00 is 0. Pure green is #00FF00: red 0, green FF is 255, blue 0. Pure blue is #0000FF: red 0, green 0, blue FF is 255. If any of those three does not render as the colour its name promises, the rendering pipeline, not the hex, is at fault — the conversions are fixed by place value, and FF is 255 in every one of them. Mix the channels and the same rule gives every other colour: #FF5733, the base guide’s example, is red 255, green 87, blue 51, a warm orange-red, because the red channel is full, the green channel is about a third, and the blue channel is about a fifth.
Why one hex digit is exactly four bits
Hexadecimal feels arbitrary until you count: 16 is 2 × 2 × 2 × 2, so one hex digit carries precisely the information of four binary digits. That is the whole reason hex exists in computing. A byte is eight bits, so it is exactly two hex digits — no rounding, no leftover bits, no conversion arithmetic. When you see a colour like #1D6FF2, you are looking at three bytes (red 1D, green 6F, blue F2) written the shortest honest way.
The practical payoff is error-checking. A mistyped binary string is invisible — 10110101 versus 10110100 differ in one hard-to-spot position — while the hex versions, B5 versus B4, differ in a single readable character. Engineers did not choose hex to be cryptic; they chose it because it is the least cryptic way to write binary down.
The two conversions worth doing by hand once
Two conversions teach the whole system. Hex to decimal: multiply each digit by its place value (1, 16, 256, 4096 from the right) and add — 2F7 becomes 512 + 240 + 7 = 759. Decimal to hex: divide by 16 repeatedly and read the remainders backwards — 759 gives remainders 7, F, 2, read as 2F7. Do each once on paper and the method is permanent; the calculator then exists to save time, not to supply understanding. The commonest slip in both directions is alignment: misplacing one digit by a single place multiplies the error by sixteen, so writing the place values above the digits first is the single best habit to adopt.
Frequently asked questions
What is a hexadecimal number?
A hexadecimal number is a number written in base 16. It uses the digits 0 to 9 and the letters A to F, where A stands for 10, B for 11, C for 12, D for 13, E for 14 and F for 15. Each position is worth a power of 16 instead of a power of 10.
How do I convert decimal 255 to hex?
Divide by 16 and keep the remainders: 255 divided by 16 is 15 remainder 15. Both remainders are 15, which is F in hex, so decimal 255 is hex FF. You can check it backwards: 15 times 16 plus 15 equals 255.
What does 0x mean in front of a hex number?
The 0x prefix is just a label that says the digits that follow are hexadecimal, not decimal. It is common in programming and in color codes. This calculator accepts it but does not require it, so FF and 0xFF mean the same value here.
How do negative hex numbers work here?
A leading minus sign means a negative value, written as minus followed by the magnitude, for example -1A means negative 26. This page does not use two’s complement notation, because that meaning depends on a fixed bit width that you would have to choose separately.
Why is one hex digit exactly 4 bits?
Because 16 is 2 to the power 4. Four binary digits can hold exactly 16 different values, from 0000 to 1111, which is exactly the range of one hex digit, from 0 to F. That is why a byte, which is 8 bits, is always exactly two hex digits.
Can this calculator handle very large hex numbers?
Yes. All math on this page uses exact integer arithmetic, so large hex values convert and calculate without the rounding that floating point numbers would introduce. There is no fixed size limit in the calculator itself, only what your browser can display.
Why is hexadecimal base 16 instead of base 10 or 12?
Because 16 is a power of 2 (2⁴), so each hex digit maps exactly to four bits. Base 10 would need messy conversion arithmetic; base 16 converts digit by digit.
How many hex digits make one byte?
Two. A byte is eight bits, and each hex digit holds four bits, so one byte ranges from 00 to FF (0 to 255 in decimal).
What do the letters A to F mean in hex?
They continue the digits past 9: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. Without them, base 16 would run out of single-character digits at 9.
Is hex case-sensitive?
No. 2f7, 2F7, and 0x2F7 all mean 759. The 0x prefix is just a label meaning "hex follows" and is not part of the value.
What is 0x10 in decimal?
16. The 0x prefix just says the digits that follow are hexadecimal, and 10 in hex means 1 time 16 plus 0, which is 16 — not ten. The same carry rule gives FF plus 1 equals 100 in hex, which is 256 in decimal, because F is the largest single hex digit, just as 9 is the largest single decimal digit.
Why does FF plus 1 give 100 in hex?
Because FF is the largest two-digit hex number, 255, and adding 1 carries into a new digit, exactly as 99 plus 1 gives 100 in decimal. The calculator shows FF plus 1 equals 100 in hex, which is 256 in decimal, and the same rule explains the base guide’s landmarks: 10 in hex is 16, FF is 255, and 100 in hex is 256.
Does the calculator accept lowercase hex and the 0x prefix?
Yes to both. Typing ff in hex shows hex FF, decimal 255, binary 1111 1111, and octal 377, exactly as typing FF does, because A to F work in either case and the display normalises to uppercase. The 0x prefix is optional, so FF and 0xFF mean the same value here, and leading zeros are dropped the same way: 00FF displays as FF with 2 digits and 8 bits.
What happens if I type a digit that is not valid for the base?
No new result is computed, and the panel keeps the previous valid answer. Typing G in hexadecimal mode, or 2 in binary mode where only 0 and 1 are valid, leaves the previous result — for example FF with decimal 255 — unchanged, with no error shown. If the panel does not change after you type, check that every digit is valid for the selected base and re-enter the number.
Summation Calculator
Add up a series term by term, with closed-form sums.
x̄Average Calculator
Mean, median and mode for a list of numbers.
σStatistics Calculator
Mean, variance, standard deviation and quartiles.
×Factoring Calculator
Break a number into its factors.
nMoles Calculator
Convert between mass, moles and molar mass.
This is a general-purpose math tool. Negative hex values here use a minus sign in front of the magnitude, not two’s complement notation. For programming or hardware work where bit width matters, check the convention your platform uses.