← All Calculators

Binary / Hex / Decimal

Convert between number bases

Binary / Hex / Decimal
Convert between number bases

How binary, decimal, hexadecimal, and octal relate

Number bases use different sets of digits to represent the same integer. Decimal is base 10, binary is base 2 and uses only 0 and 1, hexadecimal is base 16 and uses 0–9 plus A–F, and octal is base 8 and uses digits 0–7.

Worked example: 255

The decimal integer 255 is 11111111 in binary, FF in hexadecimal, and 377 in octal. Hexadecimal is compact because one hex digit represents four binary bits: F equals 1111, so FF represents eight one-bits.

Enter a non-negative whole number using only digits valid for the selected base. This converter accepts the digits themselves, not programming-language prefixes such as 0x or 0b, and it is limited to integers JavaScript can represent exactly. It does not convert fractional or negative values.

Tips for accurate results

Remember that each hexadecimal digit stands for exactly four binary digits, which is why programmers like it for compact notation. For example, decimal 255 is FF in hex and 11111111 in binary. Hex digits run from 0 to 9 and then A to F, and letters are normally case-insensitive.

Common mistakes and limits

This tool converts how a number is written, not what it means. Whether a binary pattern is a signed or unsigned integer, a character code, or a color depends on the context in your program. Watch for leading zeros and for prefixes such as 0x and 0b, which are part of the notation rather than the value.

About AllCalc

AllCalc is a free calculator hub with 51 calculators covering math, finance, health, fitness, conversions, and everyday use. Everything runs entirely in your browser — no accounts, no sign-up, no clutter. Results are for general reference only and are not a substitute for professional financial, medical, or legal advice.

Read more →

Privacy

Calculator inputs are processed in your browser. See the Privacy Policy for details about local storage, third-party advertising, and contact-form submissions.

Read the full policy →

Terms

AllCalc provides general reference calculations. Verify important results independently. Use is at your own risk.

Read the full terms →