Home/Dev Tools/Number Base Converter
BINBase 2
OCTBase 8
DECBase 10
HEXBase 16

The Four Number Systems in Computing

  • Binary (BIN, base 2) — Uses only 0 and 1. Every value stored in a computer is ultimately binary. Used directly in CPU registers, boolean logic, bitwise operations, and network subnet masks.
  • Octal (OCT, base 8) — Uses digits 0–7. Each octal digit represents exactly 3 binary bits. Common in Unix/Linux file permissions: chmod 755 means owner=7 (rwx), group=5 (r-x), other=5 (r-x).
  • Decimal (DEC, base 10) — The everyday number system using digits 0–9. Used by humans; computers convert to/from binary internally.
  • Hexadecimal (HEX, base 16) — Uses 0–9 and A–F. Each hex digit represents exactly 4 binary bits (a nibble). Compact and readable: a full byte fits in 2 hex digits. Used in color codes (#FF5733), memory addresses, and hash outputs.

How to Convert Binary to Decimal

Binary is positional — each bit position represents a power of 2. Starting from the right (position 0):

  • 1010 = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 0 + 2 + 0 = 10
  • 11111111 = 128+64+32+16+8+4+2+1 = 255 (one byte, all bits set)

This tool does the calculation instantly — just type any binary number in the BIN field.

How to Convert Decimal to Hexadecimal

Divide the decimal number by 16 repeatedly, noting the remainder at each step. The remainders (read bottom to top) form the hex digits. For example: 255 ÷ 16 = 15 remainder 15 (F); 15 ÷ 16 = 0 remainder 15 (F). So 255 = 0xFF. This tool handles any size number instantly via the DEC input field.

Bit Width and Padding

The Bit width option pads binary output to a fixed length. Choose a width that matches your target data type:

  • 8-bit — unsigned char / uint8_t. Range 0–255. 420010 1010
  • 16-bit — unsigned short / uint16_t. Range 0–65535.
  • 32-bit — unsigned int / uint32_t. Range 0–4,294,967,295.
  • 64-bit — unsigned long / uint64_t. Range 0–18,446,744,073,709,551,615.
  • Auto — no padding; shows the minimum number of bits needed.

How Prefix Notation Works

Enable Show prefix to add standard language prefixes to each output:

  • 0b — binary prefix used in Python, JavaScript, Rust, C++14+
  • 0o — octal prefix in Python 3 and JavaScript
  • 0x — hexadecimal prefix in C, C++, Python, JavaScript, and most languages

The input fields also accept these prefixes — the tool strips them automatically when parsing.

BigInt Support for Large Numbers

JavaScript's standard Number type safely represents integers only up to 253−1 (9,007,199,254,740,991 — Number.MAX_SAFE_INTEGER). Above this, floating-point rounding errors occur. This tool uses BigInt for all calculations, so any arbitrarily large integer is converted exactly. Try Number.MAX_SAFE_INTEGER via the Quick values button to see all four representations at full precision.

Common Use Cases

  • Bitwise operations — visualize what happens to a value when you AND, OR, XOR, or shift bits.
  • Color codes#FF5733 is hex; use this tool to find the decimal/binary components of each color channel.
  • Unix file permissionschmod 755 is octal; verify the binary representation (rwx bits).
  • Memory addresses — processor manuals use hex; convert to decimal or binary to cross-reference register bit positions.
  • Subnet masks255.255.255.0 is four decimal octets; each is 11111111 in binary.
  • Hash and key inspection — examine SHA-256 or AES key byte values in decimal or binary.

Related Tools