Binary, octal, decimal, hex and bases 2 to 36. Runs on your device.
Hexadecimal is the short way to write long binary values. Each hex digit stands for four bits, so a byte is always two hex digits, which is why colour codes such as FF8800, memory addresses such as 7FFE0000 and many error codes are written in hex. The digits run 0 to 9 and then A to F, where A is 10 and F is 15. This page opens with FF already typed and the From base set to hexadecimal, so it shows 255 in decimal, which is the largest value two hex digits hold. Paste a colour value, a memory address or an error code and read its decimal value at once. A 0x prefix is accepted because it matches the base, and letters can be typed in either case. The tool keeps every digit, so a 16-digit address converts exactly rather than rounded. Entering a letter past F, such as G, gives an error that names the digits the base uses.
A base says how many digits a number system uses, and each position is worth a power of that base. Decimal is base 10, so 255 means two hundreds, five tens and five ones. Binary is base 2, which uses only 0 and 1, so the same value is written 11111111: one 128, one 64, one 32, one 16, one 8, one 4, one 2 and one 1, which add up to 255. Octal is base 8 and writes that value as 377. Hexadecimal is base 16. It uses 0 to 9 and then the letters A to F for 10 to 15, so 255 is FF. The tool also accepts any base from 2 to 36. Those bases use the letters A to Z for the digits 10 to 35, so Z is 35 and ZZ is 1295. Whatever the base, the value does not change: 255 is 11111111 in binary, 377 in octal, 255 in decimal and FF in hexadecimal, and the tool shows all four at once.
Type digits from the From base. Letters A to Z are digits for bases above 10, and they are not case sensitive, so ff and FF are the same number. A prefix is accepted only when it matches the From base: 0b for binary, 0o for octal and 0x for hexadecimal. In decimal, 0x1F is an error, and the message says to set From base to Hexadecimal. Spaces and underscores are ignored, so 1111 0000 and 1111_0000 are both 240 in binary. In decimal only, commas written in thousands are ignored, so 1,000,000 is one million. A comma anywhere else is an error. A plus sign is allowed, and one minus sign makes the number negative. The tool converts whole numbers only: a decimal point or any digit after it is an error, because 1.5 would need rounding. Leading zeros do not change the value, so 00101 is 101 in binary.
A minus sign in front of the number means a negative number, and every result shows it in front of the digits: -255 is -11111111 in binary and -FF in hexadecimal. Computers store negative numbers in a fixed number of bits, usually two's complement. For a negative value the tool finds the smallest width of 8, 16, 32 or 64 bits that holds it and shows the bit pattern and its hexadecimal form. For -1 that is 11111111 in 8 bits, which is FF. For -128 it is 10000000, which is 80. For -129 it needs 16 bits: 1111111101111111, which is FF7F. A number below minus 2 to the power of 63 needs more than 64 bits, so the tool says the two's complement is not shown. The Magnitude bits tile counts the digits of the number without its sign, so -129 shows 8 there while its two's complement is 16 bits wide. The two's complement line is a view of a stored value, not a second conversion.
The tool accepts up to 1,024 digits, not counting a prefix, a sign, spaces or underscores. Longer numbers get a message asking you to shorten them. All the arithmetic uses whole-number math, so nothing is rounded: 9007199254740993, which is 2 to the power of 53 plus 1, stays exact. A 1,024-digit hexadecimal number converts to a binary result of 4,096 digits, which wraps inside its row instead of widening the page. Digit grouping, the spaces or commas that make long values easier to read, is for display only. Copy always copies the digits without any spaces or commas, with the minus sign and the letter case you chose. Nothing you type is sent anywhere or stored. The only things saved on this device are your base choices, the grouping setting and the letter case.
FF is 255 in decimal, because F is 15 and 15 times 16 plus 15 is 255. Two hex digits hold one byte, so FF is the largest value of a byte.
A number that starts with 0x is hexadecimal. Set From base to Hexadecimal, and 0x1F becomes 31. The tool gives that hint next to the error.
No. ff and FF both convert to 255. Turn on Lowercase letters to see the hex output in lower case, which Copy also uses.
255 is 11111111 in binary, 377 in octal and FF in hexadecimal. It is the largest value that fits in 8 bits, which is why a byte holds 0 to 255.
A number that starts with 0x is hexadecimal, and the x is not a decimal digit. Set From base to Hexadecimal and 0x1F becomes 31. The same rule applies to 0b for binary and 0o for octal.
No. This page converts whole numbers only. A decimal point is rejected, so type 0 or remove the digits after the point. Fractions in binary need a different method than whole numbers.
The minus sign stays in front of each base: -128 is -10000000 in binary and -200 in octal. The two's complement line shows how -128 is stored in 8 bits: 10000000, which is 80 in hexadecimal.
Up to 1,024 digits. Any value is exact, including 18446744073709551615, which is 2 to the power of 64 minus 1. In binary that is 64 ones, and in hexadecimal it is FFFFFFFFFFFFFFFF.
Bases up to 36 use 0 to 9 and A to Z, so a long number needs fewer characters. ZZ is 1295 in decimal and Z is 35. Type the base in the Other field to use one.