Free tool · Developer tools
Hex to decimal
Type a number in binary, octal, decimal, hex or any base from 2 to 36 and see it in all of them at once. It is exact for very long numbers and can show the two's complement of a negative one.
- Free
- No sign-up
- Runs in your browser
6,7191A3F in hex equals this in decimal
- Binary (2)
1 1010 0011 1111 - Octal (8)
15 077 - Decimal (10)
6,719 - Hex (16)
1A3F - Base 36
56N
- Typed
- 4 hex digits
- Size
- 13 bits, 2 bytes
How to use the Number Base Converter
- Type the number into Number to convert. Spaces, commas and underscores are ignored, and a leading minus, 0x, 0b or 0o is accepted.
- Under The number is in choose Binary, Octal, Decimal, Hex or Other base and enter a base from 2 to 36.
- Pick one more base in Also show base, and turn Group digits on or off. Choose Two's complement and a Width to see the bit pattern of a negative number.
- Press Copy beside any result. The copied text has no spaces or commas.
How do I convert hex to decimal by hand?
Every digit in a number has a place value that is a power of the base. In hex the base is 16, and the digits run 0 to 9 and then A to F for 10 to 15. Multiply each digit by its place value and add. For 1A3F: 1 × 16³ + 10 × 16² + 3 × 16 + 15 = 4096 + 2560 + 48 + 15 = 6719. The tool does this with exact whole-number arithmetic, so a 32-digit hex value gives every digit of its decimal form, not a rounded one.
Going the other way, divide by 16 repeatedly and read the remainders from last to first. Most people never need to do it by hand, but knowing the idea helps you spot a typo: a hex digit above F, a binary digit above 1 or an octal digit of 8 or 9 is not valid, and the tool names the digit and its position when it finds one.
The big answer shows decimal, unless you typed a decimal number, in which case it shows hex, since that is the usual next question. Under it, every row has its own Copy button, and the copied text is the plain digits with no grouping. A negative number keeps its minus sign in each base, so -255 is -FF in hex and -11111111 in binary; use the two's complement option below when you need the bit pattern a computer would store. The Size line tells you how many bits and bytes the value needs, which is handy when you are checking whether a number fits a field.
How do I convert binary to hex, and what is octal used for?
Binary, octal and hex fit together because 16 is 2⁴ and 8 is 2³. Every hex digit is exactly four binary digits, and every octal digit is exactly three. So to turn binary into hex, split the bits into groups of four from the right and convert each group. The example 1A3F is 1 1010 0011 1111 in binary: 1 is 0001, A is 1010, 3 is 0011 and F is 1111. In octal the same number is 15077. The tool shows the digits grouped in this way so the pattern is easy to see.
Hex is the usual way to write colors, memory addresses and byte values, because two hex digits are one byte. Octal is still common for Unix file permission modes: 755 is three groups of three bits, which the chmod calculator turns into read, write and execute boxes. Other bases are rarer: base 32 and base 36 appear in compact IDs and short links, and base 36 is the largest that fits the digits 0 to 9 plus the 26 letters. For colors in particular, use the hex to RGB converter.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1000 | 1111101000 | 1750 | 3E8 |
| 4095 | 111111111111 | 7777 | FFF |
| 65535 | 1111111111111111 | 177777 | FFFF |
How do I convert large hex values, and how does two's complement work?
Ordinary calculators and many programming languages store numbers as 64-bit floating point values, which are exact only up to 2⁵³. Past that, the last digits are silently wrong. This tool uses BigInt arithmetic, which has no fixed size, so a 128-bit hex value such as FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF converts to 340,282,366,920,938,463,463,374,607,431,768,211,455 with every digit correct. Inputs of up to 4,000 digits are accepted.
Two's complement is how computers store negative whole numbers in a fixed number of bits. To write −5 in 8 bits, take the 8-bit pattern of 5 (00000101), flip every bit (11111010) and add 1 (11111011), which is hex FB. Equivalently, add 2⁸ = 256 to a negative number: 256 − 5 = 251. Turn on Two's complement, pick 8, 16, 32 or 64 bits and the tool shows the pattern. It also works in the other direction: enter 200 with 8 bits and it tells you that pattern reads as −56 when signed. A value that does not fit the width, such as 300 in 8 bits, is reported with the valid range instead of being cut off.
Use it with
- HEX to RGB Converter: HEX, RGB, HSL, CMYK conversions.
- Chmod Calculator: unix permission calculator.
- Scientific Notation Converter: standard form both ways.
Questions
How do I convert hex to decimal by hand?
Multiply each hex digit by 16 raised to its position, counting from 0 on the right, and add the results. 1A3F = 1 × 4096 + 10 × 256 + 3 × 16 + 15 = 6719.
How do I convert binary to hex?
Split the bits into groups of four from the right and convert each group to one hex digit. 1 1010 0011 1111 becomes 1, A, 3, F, so 1A3F.
What is octal used for?
Mostly Unix file permissions, where each digit of a mode such as 755 is three bits for read, write and execute. It is also a compact way to write binary in groups of three bits.
How do I convert large hex values?
Paste them in. The tool uses BigInt arithmetic, so there is no size limit short of 4,000 digits, and every digit of the result is exact.
How does two's complement work?
A negative number is stored as 2 to the power of the bit width, plus the number. In 8 bits, -5 is 256 - 5 = 251, which is binary 11111011 and hex FB.
Is the number sent anywhere?
No. The conversion runs in your browser and nothing you type leaves your device.
How this page was made: the tool's results are computed in your browser by the code on this page; the explanations were drafted with AI help and checked against the tool's own output.