EthicalFusion

Number Base Converter

Convert numbers between binary, octal, decimal and hexadecimal.

Was this tool helpful?

Thanks for the feedback!

The Number Base Converter takes a whole number written in binary, octal, decimal or hexadecimal and shows it in all four bases at once. Choose the base your number is written in from the Input base menu, type it in the Value box, and press Convert. It is useful for programming, networking, digital electronics and computer science coursework.

Reading the result

Entering FF with Input base set to Hexadecimal gives:

  • Decimal: 255
  • Binary: 11111111
  • Octal: 377
  • Hexadecimal: 0xFF

The hexadecimal line always uses capital letters and a 0x prefix. The decimal figure uses your browser's number format, so a large value such as 4294967295 may appear as 4,29,49,67,295 in the Indian digit grouping or 4,294,967,295 in the international one.

How the conversion works

Every base uses place values that are powers of the base. In hexadecimal, FF means 15 × 16 + 15 = 255. In octal, 755 means 7 × 64 + 5 × 8 + 5 = 493. To go from decimal to binary by hand, divide by 2 repeatedly and read the remainders from bottom to top: 2024 gives 11111101000, which the tool also shows as octal 3750 and hex 0x7E8.

Binary and hex map neatly onto each other because 16 is 2 to the fourth power: every hex digit is exactly four bits. Split 11111111 into 1111 1111 and each group is F. Octal works the same way with groups of three bits.

Worked example: Linux file permissions

chmod 755 is an octal number. Convert 755 from Octal and the binary line reads 111101101. Split it into threes: 111 (read, write, execute for the owner), 101 (read and execute for the group) and 101 (read and execute for everyone else), which is rwxr-xr-x.

Common mistakes

  • Wrong input base. The menu starts on Decimal. Typing FF without switching to Hexadecimal gives "Not a valid base-10 number."
  • Invalid digits are cut off silently. Parsing stops at the first character that doesn't belong to the base, so 12G in hex is read as 12 (18 in decimal). Check that the echoed value matches what you meant.
  • Prefixes. 0xFF works with Hexadecimal selected, but a binary prefix like 0b101 reads as 0. Leave prefixes off for binary and octal.
  • Fractions and negatives. Only whole numbers are converted, so 10.75 becomes 10. Negative numbers keep a minus sign (-42 is shown as binary -101010) rather than the two's-complement form a processor would store.
  • Very large values. Above 9,007,199,254,740,991 (2 to the power 53, minus 1) the last digits are rounded, so 64-bit IDs may not convert exactly.

The conversion runs in your browser. For turning text into bits, use Text to Binary; for colour codes like #7C5CFF, the Color Converter does the hex-to-RGB split for you.

Frequently asked questions

How do I convert hex to decimal?
Set Input base to Hexadecimal, type the value such as FF, and press Convert. The decimal result appears at the top, 255 in this case.
Why do I get "Not a valid base-10 number"?
The input base is still Decimal while your value contains letters or other digits. Pick the base your number is actually written in.
Can it convert fractions like 10.5?
No. Only the whole-number part is converted, so the digits after the point are ignored.
Why does the hexadecimal result start with 0x?
The 0x prefix is the common way to mark a hex number in programming languages such as C, Java, Python and JavaScript.
What is the largest number it converts exactly?
Up to 9,007,199,254,740,991. Larger values are rounded because of how JavaScript stores numbers.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.