Number Base Converter
Type a value in any base — binary, octal, decimal, or hex — and see it instantly in the other three.
Why number bases matter
Computers store numbers as bits, but humans rarely read bits directly. Hexadecimal compresses four bits into a single character, making memory dumps, MAC addresses, color values, and file headers much easier to skim. Octal encodes three bits per character and survives in Unix file permissions. Binary is the canonical machine representation and shows up whenever bit manipulation matters.
This converter lets you type a number in any base and see it instantly in all four common bases. The classic JavaScript prefixes are recognised: 0b for binary, 0o for octal, 0x for hex, and a bare decimal otherwise. You can also force a base using the dropdown — useful when an ambiguous input such as 100 could be interpreted as 4 (binary), 64 (octal), 100 (decimal), or 256 (hex).
Use cases
- Inspect a colour HEX value as RGB component bits.
- Translate Unix file permissions between octal (0755) and the binary rwxrwxrwx layout.
- Read a memory address copied from a debugger and convert it to decimal.
- Encode a port number or magic constant as hex for a binary file format.
- Convert a Base64 alphabet index back to a 6-bit binary chunk.
Best practices
- Use the 0x prefix for hex literals in code so a reader is never in doubt about the base.
- Group long binary numbers in nibbles (4 bits) to make them easier to read.
- Be aware that JavaScript bitwise operators coerce to 32-bit signed integers — large hex values may surprise you.
- When converting negative numbers across bases, decide up front whether you want sign-magnitude or two's complement.