Number Base Converter

Convert any number between any bases 2–36: binary, octal, decimal, hex, and beyond. Shows positional expansion and repeated-division step-by-step.

🔢 Number Base Converter
Result (target base)
-
Decimal (base 10)
-
Binary (base 2)
-
Binary (grouped nibbles)
-
Octal (base 8)
-
Hex (base 16)
-
Step-by-step working

📊 What is a Number Base?

The number base (or radix) is the number of distinct digit symbols used in a positional numeral system. In positional notation, the value of each digit depends on its position: the digit at position i (counting from 0 on the right) represents that digit multiplied by the base raised to the power i.

Common bases:

  • Base 2 (binary) - digits 0, 1. The language of digital electronics.
  • Base 8 (octal) - digits 0–7. Used in Unix file permissions.
  • Base 10 (decimal) - digits 0–9. Our everyday number system.
  • Base 16 (hexadecimal) - digits 0–9 and A–F. Standard for memory addresses, color codes, and byte-level data.

Binary, octal, and hex are all powers of 2 (2¹, 2³, 2⁴), which means they interconvert without an intermediate decimal step - 4 binary digits map to one hex digit, and 3 binary digits map to one octal digit.

📐 Formula

Converting to decimal (positional expansion): n₁₀ = d_k × b^k + d_{k−1} × b^{k−1} + … + d_1 × b + d_0

Converting from decimal (repeated division):

  1. Divide n by the target base b
  2. Record the remainder (this is the lowest-order digit)
  3. Replace n with the quotient and repeat until n = 0
  4. Read remainders from bottom to top

Direct binary ↔ hex: Group 4 binary digits from the right → each group = one hex digit

Variables:

  • b - the base (radix)
  • d_i - the digit at position i
  • n - the integer value in decimal

📖 How to Use

Steps to Calculate

1
Enter the number - type in the source number using valid digits for your chosen base (letters A–Z for digits above 9 in bases 11–36).
2
Select source base - choose the base your number is currently written in (binary, octal, decimal, hex, or custom 2–36).
3
Select target base - choose the base to convert to.
4
Click Convert - the result appears in your target base, plus binary, octal, decimal, and hex equivalents shown simultaneously.
5
Read the steps - the working panel shows the full positional expansion (from any base to decimal) and the repeated-division steps (decimal to any base).

💡 Example Calculations

Example 1 — Decimal 255 to Binary, Octal, Hex

Convert 255₁₀ to all common bases

1
255 ÷ 2 repeatedly: 255 128 64 32 16 8 4 2 1 → remainders bottom-up: 11111111₂
2
Group binary into 3s from right: 011 111 111 = 377₈
3
Group binary into 4s: 1111 1111 → each group = F → FF₁₆
255₁₀ = 11111111₂ = 377₈ = FF₁₆ (this is the maximum value of one byte)
Try this example →

Example 2 — Hex A3 to Decimal and Binary

Convert A3₁₆ to decimal and binary

1
A = 10, so A3₁₆ = 10×16 + 3×1 = 160 + 3 = 163₁₀
2
A₁₆ = 1010₂, 3₁₆ = 0011₂ → 10100011₂
A3₁₆ = 163₁₀ = 10100011₂ = 1010 0011 (nibble groups)
Try this example →

Example 3 — Binary 11010 to Decimal

Convert 11010₂ to decimal

1
1×2⁴ + 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 16 + 8 + 0 + 2 + 0 = 26₁₀
11010₂ = 26₁₀ = 1A₁₆ = 32₈
Try this example →

❓ Frequently Asked Questions

What is a number base (radix)?+
A number base is the count of distinct digit symbols in a positional numeral system. Base 10 has 10 digits (0–9); base 2 has 2 (0, 1); base 16 has 16 (0–9, A–F). The digit at position i from the right represents digit × base^i. So 1A3₁₆ = 1×256 + 10×16 + 3 = 419₁₀.
How do you convert binary to decimal?+
Write out positional values (1, 2, 4, 8, 16, … from right to left). For each 1-bit, add its positional value. Example: 11010₂ = 16+8+0+2+0 = 26₁₀. For fractions: 0.101₂ = 1×(1/2) + 0×(1/4) + 1×(1/8) = 0.5+0+0.125 = 0.625₁₀.
How do you convert decimal to binary?+
Repeatedly divide by 2 and collect remainders. Read bottom-to-top. Example: 26: 26÷2=13 R0, 13÷2=6 R1, 6÷2=3 R0, 3÷2=1 R1, 1÷2=0 R1 → read up: 11010₂. The number of divisions equals the number of bits in the result.
What is hexadecimal and why is it used?+
Hexadecimal (base 16) uses 0–9 and A–F (A=10 through F=15). One hex digit represents exactly 4 bits (a nibble), so two hex digits = one byte. This makes hex very compact for binary data. Memory addresses, CSS color codes (#RRGGBB), IPv6 addresses, and SHA-256 hashes are all shown in hex.
How do you convert between binary and hex directly?+
Group binary digits into nibbles (groups of 4) from the right, padding with leading zeros. Each nibble converts to one hex digit: 0000=0, …, 1001=9, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F. Example: 10110111₂ → 1011 0111 → B7₁₆. The reverse: expand each hex digit to 4 bits.
How do you convert between binary and octal?+
Group binary digits into groups of 3 from the right (pad with leading zeros). Each group converts to one octal digit (0–7). Example: 11010110₂ → 011 010 110 → 326₈. Reverse: 5₈ = 101₂, 7₈ = 111₂. This works because 8 = 2³ — octal and binary share the same root.
What is octal used for?+
Octal (base 8) was used in early computing because 3-bit groups map naturally to hardware registers. Today its main use is Unix file permissions: “chmod 755” means owner read/write/execute (7=111₂), group read/execute (5=101₂), others read/execute (5=101₂). Octal also appears in some C/C++ literals (prefix 0) and older PDP and IBM mainframe systems.
Can all decimal fractions be represented exactly in binary?+
No — most decimal fractions are repeating in binary. Only fractions whose denominator is a power of 2 terminate in binary (1/2, 1/4, 1/8, etc.). For example, 0.1₁₀ = 0.0001100110011…₂ (repeating). This is why floating-point arithmetic has rounding errors: 0.1 + 0.2 ≠ 0.3 in IEEE 754. The calculator shows up to 12 fractional digits in the target base.
What is base 36 used for?+
Base 36 uses all alphanumeric characters (0–9, A–Z), making it the most compact case-insensitive single-character-per-digit representation. It’s used in URL shorteners (compactly encoding large IDs), vehicle identification numbers (VINs encode manufacturing info), some database ID schemes, and crockford base32 (a variant). Example: 1,000,000₁₀ = LFLS₃₆.
How many hex digits does it take to represent an n-bit number?+
Since each hex digit represents 4 bits: an n-bit number needs ⌈n/4⌉ hex digits. Common sizes: 8-bit (byte) = 2 hex digits (00–FF), 16-bit = 4 hex digits (0000–FFFF), 32-bit = 8 hex digits, 64-bit = 16 hex digits, 128-bit (IPv6 segment, UUID) = 32 hex digits. A SHA-256 hash is 256 bits = 64 hex digits.

What is a number base (radix)?

A number base (or radix) is the number of distinct digits used in a positional numeral system. Base 10 (decimal) uses digits 0–9. Base 2 (binary) uses only 0 and 1. Base 16 (hex) uses 0–9 and A–F (where A=10, B=11, ..., F=15). In base b, the digit in position i (counting from 0 on the right) represents that digit × b^i. So 1011₂ = 1×8 + 0×4 + 1×2 + 1×1 = 11₁₀.

How do you convert from binary to decimal?

Write out the positional values: the rightmost bit is 2⁰=1, next is 2¹=2, then 2²=4, 2³=8, etc. For each bit that is 1, add its positional value. Example: 11010₂ = 1×16 + 1×8 + 0×4 + 1×2 + 0×1 = 16+8+2 = 26₁₀. For a fraction like 0.101₂: 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 0.5 + 0 + 0.125 = 0.625₁₀.

How do you convert from decimal to binary?

Use repeated division by 2: divide the number by 2, record the remainder (0 or 1), then divide the quotient by 2 again, and repeat until the quotient is 0. Read the remainders from bottom to top. Example: 26 ÷ 2 = 13 R 0, 13 ÷ 2 = 6 R 1, 6 ÷ 2 = 3 R 0, 3 ÷ 2 = 1 R 1, 1 ÷ 2 = 0 R 1 → reading bottom-up: 11010₂.

What is hexadecimal and why is it used in computing?

Hexadecimal (base 16) uses digits 0–9 and letters A–F. It's used in computing because each hex digit represents exactly 4 bits (a nibble), so two hex digits represent one byte (8 bits). This makes hex a compact notation for binary data: the 8-bit value 11111111₂ = FF₁₆ = 255₁₀. Memory addresses, color codes (#RRGGBB), and machine code are typically shown in hex for readability.

How do you convert between binary and hexadecimal directly?

Group the binary digits into groups of 4 from the right (pad with leading zeros if needed), then convert each group to its hex digit. Example: 11010110₂ → split as 1101 0110 → D6₁₆. Going the other way, expand each hex digit to 4 binary bits: B4₁₆ → 1011 0100₂. No intermediate decimal step is needed because 16 = 2⁴.

How do you convert between binary and octal?

Group binary digits into groups of 3 from the right (pad with leading zeros), then convert each group to its octal digit (0–7). Example: 11010110₂ → 011 010 110 → 326₈. Going the other way: each octal digit expands to 3 binary bits: 7₈ = 111₂, 5₈ = 101₂. This works because 8 = 2³.

What are the common number bases in computing?

Binary (base 2): native language of digital hardware, where 0 = low voltage and 1 = high voltage. Octal (base 8): used in Unix file permissions (e.g., chmod 755) and some older systems. Decimal (base 10): standard for human-readable values. Hexadecimal (base 16): standard for memory addresses, color codes, cryptographic hashes, and byte-level data representation. Base 64: used for encoding binary data in text (email attachments, URLs).

What is positional notation?

Positional notation means the value of a digit depends on its position. In 342₁₀: the 3 means 3×100=300, the 4 means 4×10=40, the 2 means 2×1=2. In general, for base b: each digit d at position i contributes d×b^i. The same principle applies in any base. In 1A3₁₆ (hex): 1×256 + 10×16 + 3×1 = 256 + 160 + 3 = 419₁₀.

How do you convert decimal fractions to binary?

Use repeated multiplication by 2: multiply the fractional part by 2, record the integer part (0 or 1) as a binary digit, then continue with the remaining fractional part. Example: 0.6875₁₀: 0.6875×2=1.375 (digit 1), 0.375×2=0.75 (digit 0), 0.75×2=1.5 (digit 1), 0.5×2=1.0 (digit 1) → 0.1011₂. Not all decimal fractions terminate in binary (e.g., 0.1₁₀ is a repeating binary fraction).

What is base 36 and where is it used?

Base 36 uses digits 0–9 and letters A–Z (A=10, ..., Z=35). It's the largest single-character-per-digit base for case-insensitive alphanumeric representation. Base 36 is used in URL shorteners (for compact numeric IDs), vehicle identification numbers (VINs), and some database ID schemes where you want the largest alphabet without case sensitivity. Example: 1000₁₀ = RS₃₆.

How many bits does it take to represent a number?

The number of bits needed to represent a non-negative integer n is ⌊log₂(n)⌋ + 1 for n ≥ 1 (and 1 bit for n = 0). Examples: 0–1 needs 1 bit, 2–3 needs 2 bits, 4–7 needs 3 bits, 0–255 (a byte) needs 8 bits, 0–65535 needs 16 bits. For signed two's complement: one bit is used for the sign, so an 8-bit signed integer holds −128 to 127.