Skip to content
Toolcroft

Number Base Converter - Binary, Octal, Decimal, Hex

Developer Tools

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

How to use this tool

  1. Enter your number. Type the number you want to convert in the input field.
  2. Select the source base. Choose the base your number is currently in - binary (2), octal (8), decimal (10), hex (16), or a custom base 2–36.
  3. Read the results. The converter instantly shows the number in binary, octal, decimal, and hexadecimal. Copy any result with the Copy button.

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.

Frequently asked questions

What is binary (base 2)?

Binary is the numbering system used by computers. It has only two digits: 0 and 1. Each digit is called a "bit." Eight bits form a byte. For example, 255 in binary is 11111111 (one full byte).

What is hexadecimal (base 16)?

Hexadecimal uses 16 digits: 0–9 and A–F. Hex is popular in programming because each hex digit represents exactly 4 binary bits, making it a compact way to write binary data. For example, the byte 11111111 is FF in hex.

What is octal (base 8)?

Octal uses digits 0–7. It was popular in early computing and is still used in Unix/Linux file permissions (e.g., chmod 755). Each octal digit represents exactly 3 binary bits.

How large of a number can I convert?

This converter uses JavaScript BigInt, so there is no practical upper limit on integer size. It handles numbers with hundreds of digits accurately.

Are negative numbers supported?

Yes. Prefix your input with a minus sign (−) and the converter will carry it through to all outputs. Two's complement is not applied - the minus sign is preserved as-is.

Browse all developer tools