Developer Tools

Number Converter

Convert numbers between decimal, binary, hexadecimal, octal, ASCII, Roman numerals, and locale formats.

ASCIIN/A
RomanCCLV
Formatted255

About the number base converter

Type a whole number into any of the four fields, decimal, binary, hexadecimal or octal, and the other three update straight away, with hex shown in capitals. Underneath, the same number appears as an ASCII character, as a Roman numeral and with the digit grouping of a locale you pick: en-US, nl-NL, de-DE or fr-FR. Reading stops at the first character that doesn't belong, so 12xyz counts as 12 and typing 102 into the binary field gives 2, from the binary 10. Anything after a decimal point is dropped. Values are exact up to 9,007,199,254,740,991, the largest integer a JavaScript number can hold exactly. A minus sign is written in front, so -255 shows as -11111111 in binary and -FF in hex rather than as a two's complement pattern. The ASCII box only shows a character for codes 32 to 126, the printable range, so 65 shows A and 10, a line feed, shows N/A. Roman numerals cover 1 to 3,999, the largest value the standard form can write (MMMCMXCIX). The locale box shows how grouping differs by country: 1,234,567 in the US, 1.234.567 in the Netherlands and Germany, and 1 234 567 in France, where the gap is a narrow non-breaking space.

Frequently asked questions

Why do programmers use hex?

One hex digit stands for exactly four bits, so a byte is always two hex digits: 255 is FF and 16 is 10. That makes hex far shorter than binary while still lining up with bytes, which is why colors like #FF8800, memory addresses and file signatures are written in it.

What about negative numbers?

The converter puts a minus sign in front of the positive value, so -5 shows as -101 in binary. It doesn't show two's complement, the way computers actually store negative integers, where -5 in 8 bits is 11111011. To get that by hand, add 256 for 8 bits (65,536 for 16 bits) and convert the result: -5 + 256 = 251, which is 11111011.

Can it convert fractions or very large numbers?

No fractions; everything after the decimal point is dropped. Large numbers work, but exact results stop at 9,007,199,254,740,991, and past that the last digits get rounded. For bigger values you need a tool built on arbitrary-precision integers, such as Python or the BigInt type in JavaScript.

Why does the ASCII box say N/A?

It only fills in for 32 to 126, the printable ASCII characters from the space to the tilde. Codes below 32 are control characters such as tab (9) and line feed (10), 127 is delete, and anything above 127 isn't ASCII at all.