Free Number System Converter

Convert integers between binary, decimal, octal, and hexadecimal with explained results and easy-to-follow conversion methods.

Source Base:
Presets:
Binary (Base 2)
101101
Prefix: 0b101101
Octal (Base 8)
55
Prefix: 0o55
Decimal (Base 10)
45
Standard Positional Base 10
Hexadecimal (Base 16)
2D
Prefix: 0x2D

2. Direct Bit Grouping (Binary ↔ Octal & Hexadecimal)

Because 8 = 2³ and 16 = 2⁴, you can convert directly between binary and octal by grouping 3 bits, or hexadecimal by grouping 4 bits from right to left.

Octal (3-bit groups from right):
101↓ 5
101↓ 5
Padded binary: 101101 → Octal: 55₈
Hexadecimal (4-bit groups from right):
0010↓ 2
1101↓ D
Padded binary: 00101101 → Hex: 2D₁₆

3. Repeated Division by 2 (Decimal → Binary)

Divide the decimal integer by 2 repeatedly. Record each integer quotient and remainder until the quotient reaches 0. Read the remainders from bottom to top.

DivisionQuotientRemainder (Bit)
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Read remainders bottom-to-top: 101101₂

Understanding Number Systems

A number system defines how numerical values are written using a particular base.

The four number systems most commonly encountered in introductory computing and digital electronics are binary, octal, decimal and hexadecimal.

Each position in a number represents a power of the selected base.

For example, decimal 245 means:

2 × 100 + 4 × 10 + 5 × 1

The same place-value principle applies to other bases, but with different powers and allowed digits.

Number SystemBaseAllowed Digits
Binary20–1
Octal80–7
Decimal100–9
Hexadecimal160–9, A–F

A hexadecimal digit from A through F represents a value from 10 through 15.

How to Convert Binary to Decimal

Binary is a base-2 system. Each position represents a power of two.

Consider: 101101₂

Starting from the rightmost digit, the positional values are:

BitPlace ValueContribution
12⁵ = 3232
02⁴ = 160
12³ = 88
12² = 44
02¹ = 20
12⁰ = 11

Add the contributions: 32 + 8 + 4 + 1 = 45

Therefore: 101101₂ = 45₁₀

Binary-to-decimal conversion is an application of ordinary positional notation.

How to Convert Decimal to Binary

A common method is repeated division by two.

Convert decimal 45:

DivisionQuotientRemainder
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Read the remainders from bottom to top: 101101

Therefore: 45₁₀ = 101101₂

The same repeated-division idea can be used to convert nonnegative integers into other bases by dividing by the target base.

Binary to Octal Conversion

Octal is base 8. Because 8 equals 2³, each octal digit corresponds to exactly three binary bits.

Convert: 101101₂

Group from the right: 101 101

Each group equals decimal 5.

Therefore: 101101₂ = 55₈

If the number of bits is not divisible by three, add leading zeros on the left for grouping purposes. These added zeros do not change the numeric value.

Binary number 101101 grouped into three-bit octal digits and four-bit hexadecimal digits.
Figure 1: Direct grouping from binary 101101 into 3-bit octal chunks (55₈) and 4-bit hexadecimal chunks (2D₁₆).

Binary to Hexadecimal Conversion

Hexadecimal is base 16. Because 16 equals 2⁴, one hexadecimal digit represents four binary bits.

Convert: 101101₂

Pad on the left: 0010 1101

The first group: 0010 = 2

The second group: 1101 = 13 = D

Therefore: 101101₂ = 2D₁₆

Grouping bits directly is usually quicker than converting through decimal.

Hexadecimal to Decimal Conversion

Convert hexadecimal 2F to decimal.

Hexadecimal F represents decimal 15.

Use base-16 place values:

2 × 16¹ + 15 × 16⁰ = 32 + 15 = 47

Therefore: 2F₁₆ = 47₁₀

This method works for any valid hexadecimal integer.

Number System Comparison Example

Decimal 45 can be written in several ways:

Number SystemRepresentation
Binary101101
Octal55
Decimal45
Hexadecimal2D

All four representations describe the same numerical quantity. Only the base and the symbols used to write it differ.

Where Are Number Systems Used?

Binary in Digital Circuits

Digital circuits operate using discrete logical states commonly represented as 0 and 1.

Hexadecimal in Programming

Hexadecimal provides a compact way to display binary values. A byte can be represented using two hexadecimal digits, making it useful for inspecting memory, bit masks and binary data.

Octal in Computing

Octal appears in some computing conventions, such as Unix-style file permission notation.

Decimal for Human Input

Decimal is the familiar number system used for everyday numeric input and output.

Understanding how these bases relate is useful when working with computer architecture, digital electronics and programming.

Common Number Conversion Mistakes

Using invalid digits: Binary accepts only 0 and 1. Octal accepts only 0 through 7.

Grouping bits from the wrong side: For converting the integer part of binary to octal or hexadecimal, group bits starting from the right.

Confusing hexadecimal letters with decimal digits: A equals 10, B equals 11, continuing through F equals 15.

Losing precision with large integers: JavaScript's Number type cannot represent every large integer exactly. Use exact integer arithmetic when converting large values.

Confusing signed values with two's complement: A leading minus sign is not the same thing as a fixed-width two's-complement binary encoding.

Frequently Asked Questions

How do I convert binary to decimal?

Multiply each bit by its corresponding power of two and add the contributions.

How do I convert decimal to binary?

Repeatedly divide the number by two, record the remainders and read them in reverse order.

Why is hexadecimal used in computers?

One hexadecimal digit corresponds to four binary bits, providing a compact and readable representation of binary values.

Can this converter handle large integers?

The implementation supports large integer values using exact BigInt arithmetic, subject to reasonable input length limits to ensure fast client responsiveness.

Does this converter support fractional numbers?

This version focuses on integer conversions. It does not silently round decimal fractions or pretend to support fractional base conversion. For floating-point representations, use our IEEE 754 Converter.

Explore companion calculators and converters for digital logic design, computer architecture, and number systems.