Number Base Converter for Programmers and Students
Convert numbers between decimal, binary, octal, and hexadecimal instantly.
About Number Base Converter
Number Base Converter shows one whole number in four systems at once: decimal, binary, octal and hexadecimal. Type into any of the four fields and the other three are recalculated instantly. The page opens with 255 filled in, which shows as 11111111 in binary, 377 in octal and ff in hexadecimal, so the relationship is visible from the start.
Students preparing for computer science exams use it to check number-system homework. Programmers use it to read hex memory addresses and bit masks, web designers meet hexadecimal in color codes, and anyone working out an IPv4 subnet needs the binary form of each address number. Linux users also see octal in file permissions such as 755.
It handles non-negative whole numbers only. Negative numbers, fractions, spaces, thousands separators and prefixes like 0x or 0b are rejected. Internally the value is an ordinary JavaScript number, so it stays exact only up to 9,007,199,254,740,991. Beyond that the digits become approximate, which rules out 64-bit or longer values.
How to use Number Base Converter
- Click in the field for the system you already have: Decimal, Binary, Octal or Hexadecimal.
- Type or paste the number using only digits valid for that system: 0 and 1 for binary, 0 to 7 for octal, 0 to 9 for decimal, and 0 to 9 plus A to F for hexadecimal.
- Read the other three fields, which update as you type.
- If a message says your entry "isn't a valid base-N number", delete the offending character. The other fields keep showing the last good value in the meantime.
- Empty the field you are typing in to clear all four, then select and copy whichever value you need yourself.
Tips for best results
- Hexadecimal results are lowercase (ff, not FF). You can type letters in either case, so pasted uppercase values work fine.
- Leave out prefixes. 0xFF, 0b1010 and 0o17 are rejected, so type only the digits.
- Stay below 9,007,199,254,740,991, about nine quadrillion. The largest 64-bit number, 18446744073709551615, comes out as 10000000000000000 in hex here, which is wrong. Very large values may also show in the Decimal field in scientific notation such as 4.7e+21.
- Binary output is not padded to 8, 16 or 32 bits. Add leading zeros yourself when you need a fixed width, such as 00001010 for 10.
- Leading zeros you type are accepted and ignored in the other fields: 0007 in Decimal gives 111 in Binary.
Frequently asked questions
Which number bases are supported?
Decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16).
What happens if I type an invalid digit for a base?
A message names the problem, and the other fields keep their last valid values until you correct the entry, so check for the error message before trusting them.
Can it convert negative numbers or fractions?
No. Only whole numbers from zero upward are accepted, and a minus sign or decimal point triggers the invalid-number message. Two's complement and floating-point formats are not shown.
How do I convert binary 1010 to decimal?
Type 1010 in the Binary field and read the Decimal field, which shows 10. Each binary digit is worth a power of two, so 1010 is 8 + 0 + 2 + 0.
What is the largest number I can convert reliably?
9,007,199,254,740,991, which is 2 to the power 53 minus 1. Past that point the value is rounded to the nearest number JavaScript can store, so the digits may be wrong.
Why does hexadecimal use letters?
Hexadecimal has 16 digits but we only have ten numerals, so A to F stand for 10 to 15. FF is therefore 15 x 16 + 15, which is 255.