Number Base Converter

Convert whole numbers between bases 2 and 36 with strict digit validation, place-value expansion, and reversible conversion.

For nearby conversion tasks, compare the binary-to-decimal calculator and hexadecimal calculator when the representation changes but the underlying integer does not.

The number base converter translates integers and fractional numbers between any combination of standard number bases: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16), as well as arbitrary bases from base 2 to base 36. Number base conversion is a foundational skill in computer science, electronics, and digital systems design: computers process everything in binary; memory addresses, colour codes, and file permissions are expressed in hexadecimal; Unix file permissions use octal. Understanding how base conversion works — and how the same number looks completely different written in binary versus hex — is essential for reading assembly code, debugging memory dumps, working with IP addresses, and configuring network equipment.

Hexadecimal is especially prevalent in web development (CSS hex colour codes like #FF5733), cryptography (SHA-256 hashes, cryptographic keys), and low-level programming (memory addresses in debuggers).

  1. Enter your number in the source base (e.g. decimal 255, binary 11111111, hex FF).
  2. Select the source base (2 = binary, 8 = octal, 10 = decimal, 16 = hexadecimal, or enter a custom base).
  3. Select the target base for conversion.
  4. The calculator instantly displays the converted value and shows the step-by-step division/multiplication method used.
  5. For fractional conversion (e.g. decimal 0.625 to binary): the calculator applies repeated multiplication, noting integer parts at each step.

Number base conversion methods

To convert from any base to decimal: multiply each digit by its base raised to its positional power and sum.

Binary 1011 → decimal: 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11.

Hex A3 → decimal: 10×16¹ + 3×16⁰ = 160 + 3 = 163.

To convert from decimal to any base: repeatedly divide by the target base; remainders (read bottom-to-top) give the result.

Decimal 163 → hex: 163÷16 = 10 R3; 10÷16 = 0 R10 (=A). Read upward: A3.

Binary-Hex shortcut: group binary digits in sets of 4 from the right; each group converts directly to one hex digit. 10100011 → 1010 (=A) 0011 (=3) → A3.

Binary-Octal shortcut: group in sets of 3. 10100011 → 010 (=2) 100 (=4) 011 (=3) → 243 octal.

Common number base reference

Quick reference: decimal 0–16 in all bases

Quick reference — decimal : binary : octal : hex: 0:0:0:0 | 1:1:1:1 | 2:10:2:2 | 3:11:3:3 | 4:100:4:4 | 5:101:5:5 | 6:110:6:6 | 7:111:7:7 | 8:1000:10:8 | 9:1001:11:9 | 10:1010:12:A | 11:1011:13:B | 12:1100:14:C | 13:1101:15:D | 14:1110:16:E | 15:1111:17:F | 16:10000:20:10. Practical context: 8-bit byte range = 0–255 decimal = 00–FF hex = 0–377 octal. IPv4 address: each octet is a decimal number 0–255. CSS colour #FF5733: R=255, G=87, B=51 in decimal.

Math tips and best practices

Common mistakes to avoid

Number base conversions are exact mathematical operations for integer inputs. Fractional conversions in non-decimal bases may produce non-terminating representations (e.g. decimal 0.1 in binary = 0.000110011… repeating) — the calculator truncates to a specified number of binary places, which introduces a small rounding error. For cryptographic, security, or precision-critical applications, use a dedicated library or verified mathematical tool rather than a general-purpose web calculator. Hex colour codes in this calculator follow the CSS/W3C standard; other colour representations (HSL, RGB, CMYK) require separate conversion tools.

Frequently Asked Questions

How do you convert decimal to binary?

Divide the decimal number by 2 repeatedly and record the remainders from bottom to top. Example: 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1 → 13 in binary is 1101.

How do you convert binary to hexadecimal?

Group binary digits into sets of 4 from right to left, then replace each group with its hexadecimal digit (0–9, A–F). Example: 10110111 → 1011|0111 → B7 in hex.

What is hexadecimal used for?

Hexadecimal (base 16) is widely used in programming, colour codes (#RRGGBB), memory addresses, and representing binary data compactly — each hex digit represents exactly 4 binary bits.

What is octal number system?

Octal is base 8, using digits 0–7. It was historically used in computing as a compact representation of binary, where each octal digit represents 3 binary bits.

What is two's complement?

Two's complement is the standard way to represent negative integers in binary. To negate a number: flip all bits, then add 1. It allows addition and subtraction to use the same hardware circuit.

Related Calculators