Skip to content
Toolcroft

Developer Tools

Number Base Converter - Binary, Octal, Decimal, Hex

Convert numbers between binary, octal, decimal, hexadecimal, and any base 2–36. Supports large numbers via BigInt. Results update instantly - no page reload required.

Number bases explained

Every positional number system has a base (also called a radix) that determines how many distinct digits it uses and what each position is worth.

  • Binary (base 2): digits 0–1. Used internally by every computer.
  • Octal (base 8): digits 0–7. Used in Unix/Linux file permissions.
  • Decimal (base 10): digits 0–9. The everyday system humans use.
  • Hexadecimal (base 16): digits 0–9 and A–F. Ubiquitous in web colors, memory addresses, and bytecode.

How to convert between bases

Converting from any base to decimal is straightforward: multiply each digit by its base raised to the power of its position (counting from the right, starting at 0), then add the results. For example, binary 1101 = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8+4+0+1 = 13.

Converting from decimal to another base uses repeated division: divide the number by the target base repeatedly, collecting remainders from bottom to top. This converter handles all of that automatically, using BigInt for arbitrarily large numbers.

Hexadecimal in web development

CSS colors like #FF6347 (tomato red) are three hexadecimal byte pairs: FF (red channel = 255), 63 (green = 99), 47 (blue = 71). Understanding hex makes it easier to read and modify color values by hand.

Binary and bits

A single binary digit is a bit. Eight bits form a byte, which can represent values 0–255 (unsigned). The bit pattern visualizer below the results groups bits into nibbles (4-bit groups) for easier reading, the same way hex digits map to nibbles.

Octal and Unix permissions

Unix file permissions like chmod 755 use octal. The digit 7 is binary 111 (read + write + execute), 5 is 101 (read + execute). Each octal digit maps to exactly 3 bits, making it a concise notation for 3-bit groups.

Step-by-step conversion example

Converting decimal 255 to other bases using the division algorithm:

  • 255 -> hexadecimal: 255 ÷ 16 = 15 remainder 15 -> digit F; 15 ÷ 16 = 0 remainder 15 -> digit F. Read remainders bottom-to-top: FF. (255 = 15×16 + 15)
  • 255 -> binary: 255 = 128+64+32+16+8+4+2+1 = all 8 bits set -> 11111111
  • 255 -> octal: 255 ÷ 8 = 31 r7; 31 ÷ 8 = 3 r7; 3 ÷ 8 = 0 r3. Read bottom-to-top: 377

Notably, 0xFF in hex = 0b11111111 in binary = 0o377 in octal = 255 in decimal - all representations of the same value: the maximum unsigned byte.

Floating-point note

Base conversion as described here applies only to integers. Floating-point numbers (decimals) require separate treatment: the fractional part is converted by repeated multiplication rather than repeated division, and many simple decimals (like 0.1) have non-terminating representations in binary (leading to IEEE 754 floating-point precision surprises). Use the IEEE 754 tool for floating-point bit analysis.

XOR and base conversions in cryptography

XOR (exclusive-or) is the fundamental operation in stream ciphers, block cipher rounds, and hash functions. XOR operations are immediately readable in hexadecimal or binary form: 0xA5 XOR 0xFF = 0x5A is trivially visible in hex, while the same operation in decimal (165 XOR 255 = 90) requires mental conversion. This is why cryptographic analysis, byte-level debugging, and protocol inspection almost always use hex or binary representation - base conversion tools become indispensable.