Binary, Decimal & Hex Converter
Convert between binary, octal, decimal and hexadecimal.
The value is read in the FROM base and rewritten in the TO base with big-integer math, so long numbers keep every digit. Letters a–f cover hex; the conversion runs in this tab.
// What each base is used for
- >Base 2 — binary — Only 0 and 1. Bit masks, feature flags and anything that maps onto hardware are written this way.
- >Base 8 — octal — Groups binary into threes; file permissions such as 755 are the usual place you meet it.
- >Base 10 — decimal — The base people read by default, and the one to convert to before a value goes into a report or a form.
- >Base 16 — hex — 0–9 plus a–f. One digit is exactly four bits, so 0xFF is one byte — colours and memory addresses use it.
// Negatives, long values and decimals
A leading minus sign survives the conversion, and the digits are handled with big-integer math, so a long value keeps all of them instead of rounding the way a JavaScript Number would.
Only whole numbers are converted: a decimal point is not a digit in any of the four bases, so it is rejected with the same error as a wrong digit.
// Questions about this tool
How do I convert decimal to binary?
Set FROM BASE to 10 / decimal and TO BASE to 2 / binary, type the decimal value, and read the binary digits on the right.
How do I convert hex to decimal?
Choose 16 / hex as FROM BASE and 10 / decimal as TO BASE. Digits a–f are accepted in either case.
Why did I get an error?
One character is not valid for the FROM base — a letter in a decimal value, a 2 inside a binary value, or a decimal point anywhere.
Can it handle negative and very long values?
Yes. A leading minus sign is kept through the conversion, and big-integer math means a long value keeps every digit.