The formula
How it works
Convert a number between hexadecimal, decimal, binary and octal. Enter a value, choose the base it is written in, and the calculator shows it in all four bases.
FAQ
Why is hexadecimal used in computing?
Hex is a compact way to write binary: each hex digit maps exactly to four binary bits, so a byte is just two hex digits. That makes it far easier to read and type than long strings of ones and zeros, which is why colours, memory addresses and byte values are usually shown in hex.
What do the letters A–F mean?
Hexadecimal is base 16, so it needs sixteen digit symbols. After 0–9 it uses the letters A to F for the values ten to fifteen. So the hex number FF is 15×16 + 15 = 255 in decimal, and A0 is 10×16 = 160.
Can this calculator convert negative numbers?
No — it works with whole, non-negative values only. Negative numbers in computing are usually represented with two’s complement, which depends on a fixed bit width and isn’t a simple base conversion.
Is there a limit to how large a value I can convert?
The calculator relies on standard integer parsing, so extremely large values may lose precision beyond the range JavaScript can represent exactly. For everyday values like colours, addresses and byte counts this isn’t a concern.
Why does 0x sometimes appear before a hex value?
The 0x prefix is a common programming convention that marks a number as hexadecimal so it isn’t mistaken for decimal. This calculator strips a leading 0x automatically if you paste one in.
Do leading zeros change the value?
No — leading zeros don’t affect a number’s value in any base, so 0F and F both equal 15. They’re often added only to pad a value to a fixed number of digits, such as two digits per byte.
Why are there only four base options here?
Decimal, hexadecimal, binary and octal are by far the most common bases in everyday computing and maths, covering nearly every practical use case. Other bases exist but are rarely needed outside specialised contexts.
About the hex calculator
This calculator converts a whole number between the four bases most used in computing and maths: hexadecimal (base 16), decimal (base 10), binary (base 2) and octal (base 8). You enter a value in whichever base you have and it shows the equivalent in all the others. It is a quick reference for anyone working with colour codes, memory addresses, bit masks or low-level data.
How to use it
Type the value and select the base it is written in — decimal, hexadecimal, binary or octal. The calculator parses it and displays the number in all four bases at once. For example, the hex value FF converts to 255 in decimal, 11111111 in binary and 377 in octal. Hex letters can be entered in upper or lower case.
The formula
A number in any base is the sum of its digits times powers of the base, , where the rightmost digit has power zero. Converting means reading the value into a single whole number using its own base, then re-expressing that number by repeatedly dividing by each target base. The calculator does both directions automatically.
Where it is used
Programmers use it constantly — web colours like #FF8800, hexadecimal memory addresses, and binary flags all call for base conversion. Students of computer science learn to move between bases as a core skill. Anyone reading a hex dump, setting a bit mask, or decoding a colour value benefits from seeing the same number in every base at a glance.