How this instrument works
Binary is positional notation with a base of two rather than ten: each place, moving right to left, is worth double the one before it — 1, 2, 4, 8, 16, 32 and onward — instead of the tenfold steps decimal uses. A single digit in this scheme is a bit, short for binary digit, and it can only ever be 0 or 1. To write a decimal number in binary, this converter repeatedly divides the value by two and keeps each remainder; stacking those remainders from the last one found to the first spells out the answer, one bit at a time, and that same repeated-halving routine is what runs behind the field below.
The idea is older than electronics. Gottfried Wilhelm Leibniz worked out a complete binary arithmetic in 1679 and published it in 1703 as 'Explication de l'arithmétique binaire', noting with evident pleasure that his 0s and 1s matched the broken and unbroken lines of the ancient Chinese Yijing hexagrams a missionary correspondent had sent him. For a century and a half afterward binary stayed a mathematical curiosity. George Boole's 1854 algebra of true and false gave it a logical footing, and Claude Shannon's 1937 master's thesis showed that this same two-valued algebra could be built directly out of relay switches — the paper that let engineers design circuits by treating 0 and 1 as physical, not just symbolic.
That link to switches is why every computer built since has counted this way rather than in tens. A transistor is cheaply and reliably read as either passing current or not; distinguishing ten clean voltage levels from one another, especially after electrical noise creeps in, is a far harder engineering problem than distinguishing two. Group eight of these digits into a byte and you span 0 through 255 — the range a single pixel's brightness, a text character, or one field of an IP address is typically stored in — and larger values simply borrow more bytes. The arithmetic your processor performs on any number, no matter which base you typed it in, happens in this base-2 form underneath.
- Enter any whole number into the Decimal number field — 42 loads by default so you can see a real conversion immediately.
- The Binary representation field updates as you type, showing the base-2 digit string one bit at a time, left to right.
- Only zero and positive whole numbers are accepted; a negative entry triggers a message asking for 0 or greater, since plain binary here carries no sign.
- Read the result as bit values: the leftmost digit is the most significant bit, worth the highest power of two used; the rightmost is the least significant.
- Count the digits to gauge size at a glance — an eight-digit result means the value fits inside a single byte, 0 through 255.
Worked example — converting 42 to binary
Enter 42 into the Decimal number field. Dividing by two and keeping the remainder at each step runs: 42÷2=21 r0, 21÷2=10 r1, 10÷2=5 r0, 5÷2=2 r1, 2÷2=1 r0, 1÷2=0 r1. Stop once the quotient hits zero, then read the six remainders from the last one found back to the first: 1, 0, 1, 0, 1, 0 — giving 101010, exactly what Binary representation returns.
A quick check confirms it without long division at all: 101010 has 1s in the positions worth 32, 8 and 2 (that is, 2^5, 2^3 and 2^1), and 32 + 8 + 2 = 42. Try 255 next and every one of the eight positions turns on — 11111111 — since 255 is 2^8 − 1, the largest number a single byte can hold. Try 0 and the field simply returns 0, one digit, nothing left to carry.
Questions
Why do computers use binary instead of decimal?
Because a transistor is fundamentally a two-state switch: current is flowing or it isn't, a voltage reads high or low. Two clean states are cheap and reliable to build and easy to tell apart even after electrical noise, where ten distinct voltage levels are not. Every processor built since Claude Shannon's 1937 thesis connected Boolean algebra to relay switches has done its arithmetic on that plain on/off choice, and base-2 numerals are simply the natural way to write down what those switches are doing.
What is a bit, and what is a byte?
A bit is one binary digit, either a 0 or a 1 — the term is short for 'binary digit', credited to statistician John Tukey around 1947. Group eight bits together and you get a byte, the standard unit computers use to store one character or a small number. Eight digits span 00000000 through 11111111, so a byte holds 256 distinct values, 0 through 255 — enter 255 above and watch it return eight 1s.
How do I convert binary back to decimal by hand?
Multiply each digit by the power of two matching its position, counting from zero on the right, then add the results together. For 101010, the 1s sit in positions 5, 3 and 1, worth 32, 8 and 2, and 32 + 8 + 2 = 42. That column-by-column expansion is the mirror image of the repeated-division method this calculator performs, and it works for a digit string of any length.
Does zero have a binary representation?
Yes — zero in this base is simply 0, a single digit with nothing further to strip away. It's the one input where the repeated-division method stops before it starts, since 0 divided by 2 is already 0 with no remainder to record. Enter 0 into the Decimal number field and Binary representation reads back that same single digit.
Why can't I enter a negative number?
Plain positional notation, as shown here, carries no built-in sign, so there's no single agreed way to write a negative value without first choosing a scheme. Machines that need negatives generally use two's complement, where the leftmost digit is repurposed to subtract a power of two rather than add one — a separate convention with its own rules, not a simple extension of this notation. That's why the field asks for 0 or greater rather than guessing which scheme you had in mind.
Who invented the binary number system?
Gottfried Wilhelm Leibniz gave it its first full mathematical treatment, working it out in unpublished notes as early as 1679 and publishing 'Explication de l'arithmétique binaire' with the French Academy of Sciences in 1703. He noted that his 0s and 1s echoed the broken and unbroken lines of the ancient Chinese Yijing hexagrams a missionary correspondent had shown him. It took George Boole's 1854 algebra and Claude Shannon's 1937 thesis tying that algebra to switching circuits before this counting scheme became the working language of machines rather than a mathematical curiosity.
How many digits will a given decimal number need?
One more than its base-2 logarithm, rounded down: digit count equals floor(log2(x)) + 1 for any x of 1 or greater. 42 needs six digits since 2^5 = 32 is the largest power of two at or below it, matching the six-digit result 101010 above. 255 needs eight, exactly filling one byte — no accident, since 2^8 − 1 = 255 is the largest value eight digits can hold.
Is this the same binary that IP addresses or file sizes use?
Same positional system, different grouping. An IPv4 address is four bytes, each shown as a decimal number from 0 to 255 standing in for its own eight-digit form — 192, for instance, is 11000000. File and memory sizes lean on it too, though there the powers of two get bundled into kilobytes and megabytes rather than displayed digit by digit. The underlying base-2 arithmetic this calculator performs is identical in every case; only the packaging around it changes.