Binary Converter
Binary is the actual language computers operate in underneath everything else — this shows a decimal number's exact binary form, plus its hex and octal equivalents for cross-reference.
Inputs
Result
101010
Hex 2A · Octal 52
How the binary converter works
Decimal-to-binary conversion repeatedly divides by 2, recording the remainder at each step — the remainders, read bottom to top, form the binary representation.
The same number is also converted to hexadecimal (base 16) and octal (base 8) for comparison, since all three are common ways of representing the same underlying binary value.
Worked example: decimal 42
- 42 ÷ 2 = 21 r0, 21 ÷ 2 = 10 r1, 10 ÷ 2 = 5 r0, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1.
- Reading remainders bottom-to-top: 101010.
- Hex: 2A. Octal: 52.
Common mistakes to avoid
Reading a binary number's digits left-to-right as if it were decimal place value
Binary place values double from right to left (1, 2, 4, 8, 16...), not the powers of 10 used in decimal — the leftmost digit of a binary number represents a much larger place value than intuition based on decimal might suggest.
Entering a non-integer or negative number expecting a sensible binary result
This converter is built for non-negative whole numbers — negative numbers and fractions in binary use different representations (two's complement, fractional binary) not covered by this straightforward conversion.
Frequently asked questions
Why does computer hardware use binary specifically, not decimal?
Binary maps directly onto a simple physical reality — a transistor or switch being either on or off (1 or 0) — which is far more reliable and simpler to build reliably at massive scale than hardware that would need to distinguish 10 different voltage levels for decimal.
How many binary digits (bits) does it take to represent a given decimal number?
Roughly log₂(n) + 1 bits are needed for a number n — 42 needs 6 bits (as shown above), while 255 needs exactly 8 bits (a full byte), and 256 needs 9.
What's the relationship between binary and a 'byte'?
A byte is defined as exactly 8 binary bits, capable of representing decimal values from 0 to 255 — this is why byte-based units (kilobyte, megabyte) and hex (which maps 2 digits per byte) are so closely tied to binary's structure.
Why is octal (base 8) also shown here?
Like hex, octal is a power of 2 (2³), so it also maps cleanly onto binary — 3 binary bits per octal digit — though it's less commonly used today than hex in most modern programming contexts.
Related calculators
Hex Converter
Convert hexadecimal values to decimal and binary.
Decimal Converter
Convert a number between any two bases (2–36).
ASCII Converter
Convert text to ASCII character codes.
Subnet Mask Calculator
Mask, host count and wildcard from a CIDR prefix.
Hash Generator
Fast non-cryptographic checksum for any string.