Free · No sign-up · Runs in your browser

Number Base Converter

Enter a number in any base and see it in binary, octal, decimal, and hexadecimal simultaneously. Prefixes like 0x and 0b are handled automatically.

11111111Binary
377Octal
255Decimal
FFHexadecimal

The four bases

  • Binary (base 2) — digits 0 and 1. How computers physically store everything.
  • Octal (base 8) — digits 0–7. Now mainly seen in Unix file permissions, where 755 means read-write-execute for the owner and read-execute for everyone else.
  • Decimal (base 10) — the everyday system.
  • Hexadecimal (base 16) — digits 0–9 then A–F. Compact and maps cleanly to binary, which is why it appears in colour codes, memory addresses, and byte values.

Why programmers use hexadecimal

Each hex digit represents exactly four binary digits, so one byte is always precisely two hex characters. That makes conversion between hex and binary mechanical, with no arithmetic required — FF is 11111111, always. Decimal has no such clean relationship, which is why memory dumps, colour codes like #9c3b27, and byte-level data are all conventionally written in hex.

Reading the prefixes

Most languages mark the base with a prefix: 0x for hexadecimal, 0b for binary, and 0o — or in older C, a bare leading zero — for octal. That bare leading zero is a genuine trap: in C and older JavaScript, 010 is octal for 8, not ten. It is exactly why modern languages require the explicit 0o form. This converter strips any of these prefixes automatically.


Frequently asked questions