Binary Hex Octal Decimal Converter

This converter lets you type a number in any of the four most common positional number systems and see the equivalent in all three other bases instantly. Type in the binary field and the decimal, hexadecimal, and octal fields update in real time. Type in the hex field and the others follow. The same works for octal and decimal. Binary (base 2) uses only the digits 0 and 1 and is the native language of digital hardware. Hexadecimal (base 16) uses digits 0 through 9 and letters A through F, and is widely used in programming, colour codes, memory addresses, and checksums because each hex digit represents exactly four binary bits, giving a compact shorthand for long binary strings. Octal (base 8) uses digits 0 through 7 and appears in Unix file permission codes and some legacy computing contexts. Decimal (base 10) is the everyday number system most people use. The converter uses JavaScript's parseInt to parse each input in its respective base, then uses toString to convert to the other three bases. Hexadecimal output is shown in uppercase. The binary field accepts only 0s and 1s; the octal field accepts 0 through 7; the hex field accepts 0 through 9 and A through F (case-insensitive). Invalid characters are ignored and the remaining valid digits are parsed. This tool is useful for programming students learning base conversion, developers debugging bitwise operations, network engineers reading MAC addresses and IPv6 in hex, and system administrators writing chmod commands in octal. The converter handles non-negative integers only; it does not support negative numbers or fractional values in any base.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner: Premium Homes
255
decimal value
HexFF
Binary11111111
Octal377

How it works

When you type in any field, the converter reads the value from that field and calls parseInt(value, base) to convert it to a JavaScript integer. It then calls (n).toString(2), (n).toString(8), (n).toString(10), and (n).toString(16) to populate all four output fields and the results card. To prevent update loops, the converter temporarily removes event listeners from the other three fields while updating them, then reattaches them after. Hexadecimal values are displayed in uppercase. Numbers above 2^53 - 1 may lose precision due to JavaScript using 64-bit floating-point representation.

Worked example

Enter FF in the hexadecimal field: parseInt('FF', 16) = 255. Converting 255 to binary gives 11111111. Converting to octal gives 377. The decimal value is 255. These match the default values pre-filled in all four input fields above.

Related calculators