Skip to main content

Number Base Converter

No popups. No autoplay ads. Accurate answers with formulas shown.

Specialty Tools

Number Base Converter

Convert between binary, decimal, hexadecimal, and octal number systems instantly.

Formatted Values

Binary:10 1010
Octal:52
Decimal:42
Hexadecimal:2A
Step-by-Step Conversion

Convert Decimal "42" to Binary:

42 รท 2 = 21 remainder 0 21 รท 2 = 10 remainder 1 10 รท 2 = 5 remainder 0 5 รท 2 = 2 remainder 1 2 รท 2 = 1 remainder 0 1 รท 2 = 0 remainder 1

Read remainders bottom-to-top: 101010

Convert Decimal "42" to Octal:

42 รท 8 = 5 remainder 2 5 รท 8 = 0 remainder 5

Read remainders bottom-to-top: 52

Convert Decimal "42" to Hexadecimal:

42 รท 16 = 2 remainder A 2 รท 16 = 0 remainder 2

Read remainders bottom-to-top: 2A

How Positional Number Systems Work

Every number system we use daily is positional โ€” the value of a digit depends on its position. In decimal (base 10), the number 347 means 3ร—10ยฒ + 4ร—10ยน + 7ร—10โฐ = 300 + 40 + 7. Binary (base 2) works identically but with powers of 2: the binary number 1011 means 1ร—2ยณ + 0ร—2ยฒ + 1ร—2ยน + 1ร—2โฐ = 8 + 0 + 2 + 1 = 11 in decimal. This same principle applies to octal (base 8) and hexadecimal (base 16). Understanding this pattern makes converting between any two bases straightforward: convert to decimal as an intermediate step, then convert from decimal to the target base.

Binary: The Language of Computers

Computers use binary because transistors โ€” the fundamental building blocks of processors โ€” have two states: on (1) and off (0). Every piece of data in a computer, from text to images to videos, is ultimately stored as sequences of binary digits (bits). A group of 8 bits forms a byte, which can represent values from 0 (00000000) to 255 (11111111). This is why many computing limits relate to powers of 2: a 32-bit integer can hold values up to 2ยณยฒ โˆ’ 1 = 4,294,967,295, and a 64-bit system can address 2โถโด bytes of memory (16 exabytes). ASCII encodes each character as a 7-bit binary number, while modern Unicode extends this to 21 bits per code point.

Hexadecimal in Practice

Hexadecimal's power lies in its compact representation of binary data. Since 16 = 2โด, each hex digit maps to exactly 4 binary digits. This means a full byte (8 bits) is always exactly 2 hex digits, and a 32-bit value is 8 hex digits โ€” far easier to read than 32 binary digits. In web development, CSS colors use hex notation (#RRGGBB) where each pair represents one byte (0โ€“255) of red, green, or blue intensity. In debugging, memory addresses and machine code are displayed in hex. MAC addresses (like A4:CF:12:D0:5B:3E) use hex to represent 6 bytes of network hardware identification. Even Unicode code points are written in hex (U+1F600 is the grinning face emoji).

Frequently Asked Questions

What are binary, decimal, hexadecimal, and octal number systems?

These are positional numeral systems that use different bases. Binary (base 2) uses digits 0โ€“1 and is the foundation of computing. Octal (base 8) uses 0โ€“7 and was common in early computing. Decimal (base 10) uses 0โ€“9 and is the standard human number system. Hexadecimal (base 16) uses 0โ€“9 and Aโ€“F, and is widely used in programming to represent colors, memory addresses, and byte values.

How do I convert binary to decimal?

Multiply each binary digit by 2 raised to the power of its position (counting from 0 on the right), then sum all the results. For example, binary 1010 = 1ร—2ยณ + 0ร—2ยฒ + 1ร—2ยน + 0ร—2โฐ = 8 + 0 + 2 + 0 = 10 in decimal.

Why is hexadecimal used in programming?

Hexadecimal is popular in programming because each hex digit maps exactly to 4 binary digits (bits), making it a compact way to represent binary data. For example, the byte 11111111 in binary is simply FF in hex. This makes hex ideal for representing colors (#FF5733), memory addresses, and byte values.