Developer Tools

Number Base Converter

Convert numbers between binary, octal, decimal and hex.

Rate this tool

How to use the Number Base Converter

  1. Enter your value.
  2. Choose which base it is in.
  3. Read the value in all four bases.

About the Number Base Converter

Different bases exist because different readers need them. Hardware is two-state, so underneath everything is binary. Hexadecimal earns its place because one hex digit maps to exactly four bits — so a byte is always two hex digits, readable at a glance. That clean mapping is why hex turns up in colour codes, memory addresses, MAC addresses and byte dumps. Octal packs three bits per digit, which is exactly why Unix file permissions read as 755 or 644 — three groups of three bits, one each for user, group and other.

Enter a value, tell the tool which base it is written in, and you get all four at once. Know the real bounds: the input must be digits only, so no minus sign, no decimal point and no 0x prefix. Negatives and fractions are rejected rather than guessed at. Hex letters may be upper or lower case; the hex output is uppercase.

Precision has a hard ceiling. Conversion goes through a JavaScript number — an IEEE-754 double — so integers are exact only up to 9,007,199,254,740,991. Past that, values round to the nearest representable double and the low digits of the binary or hex output will be wrong, which puts a 64-bit hash or ID out of range. For characters rather than numbers, use text to binary; for hex colour codes, HEX to RGB. Everything runs in your browser.

Frequently asked questions

Why do programmers use hexadecimal instead of binary?

Because one hex digit is exactly four bits, so hex is a lossless, compact shorthand for binary that people can read. A byte is two hex digits, a 32-bit colour is eight. Translating between hex and binary needs no arithmetic — just substitution.

Can I convert negative numbers or decimals?

No. This converter accepts digits only, so a minus sign or a decimal point is rejected as invalid. It handles non-negative whole numbers in base 2, 8, 10 and 16.

Why is my very large hex value converting wrong?

Values pass through a double-precision float, which represents integers exactly only up to 9,007,199,254,740,991. Anything larger gets rounded, so the low digits of the output are unreliable. A 16-digit hex value — a 64-bit hash, for instance — is beyond that limit.

Why are Unix permissions written in octal?

Because permissions come in three bits — read, write, execute — and one octal digit holds exactly three bits. So 755 is three digits covering user, group and other, with 7 meaning all three bits set.

Can I use bases other than 2, 8, 10 and 16?

Not here — the input base selector offers those four, and all four are shown in the output. They cover nearly every practical case in programming.