Worked example: Binary Calculator
Ten plus three. This fixed reference example shows one complete scenario; the interactive results above use your current inputs.
View the example inputs
- Calculate
- Arithmetic
- First integer
- 1010
- Operation
- Add
- Second integer
- 11
| Calculated quantity | Example result |
|---|---|
| Base 2 result | 1101 |
| Decimal result | 13 |
Binary Calculator: connect every bit to its place value
How do I convert binary to decimal?
Each binary position has a power-of-two weight, starting with 1 on the right. A digit of 1 contributes its weight; a digit of 0 contributes nothing. For 10110, the weights are 16, 8, 4, 2 and 1, giving 16 + 4 + 2 = 22. The notation changes, but the integer does not.
The Binary Calculator includes a complete place-value ledger, not only a converted answer. Use it to identify the exact contribution of each bit and check that the contributions sum to the decimal result. A minus sign applies to the entire magnitude; it is not another binary digit.
Python documentation: integer conversion and number formatting
Why does 1 + 1 equal 10 in binary?
A binary column can hold only 0 or 1. Adding two ones gives decimal 2, written as 10 in base two: write 0 in the current column and carry 1 to the next. If another carry arrives, 1 + 1 + 1 gives 11, so the written digit and the carried digit are both 1.
For 111 + 1, the carry passes through three columns and the result is 1000. The addition ledger runs from the units place upward and records carry-in, result digit and carry-out separately. Leading carry columns are included rather than clipped to a fixed number of bits.
How does borrowing work in binary subtraction?
When the current top bit is too small, borrow one unit from the next binary place. That borrowed unit is worth two units in the current column. For 1000 − 1, borrowing propagates across the zeroes and the result is 111.
Signed addition and subtraction can reduce to either adding magnitudes or subtracting the smaller magnitude from the larger. The ledger explains that reduction and the result retains the mathematical sign. It does not interpret the input as an eight-bit register or silently wrap a negative result into a machine encoding.
What happens when binary division has a remainder?
Integer division and fractional division answer different questions. For 101 ÷ 10, the integer quotient is 10 with remainder 1: in decimal, 5 = 2 × 2 + 1. Continuing past the point gives 10.1 in binary, which is decimal 2.5.
The calculator preserves its integer-quotient result and shows the fractional quotient separately. Parentheses enclose a detected repeating block, while an ellipsis means the selected digit limit was reached. With negative inputs, the integer quotient truncates toward zero and the remainder takes the dividend’s sign.
Can I calculate with binary integers larger than 53 bits?
Yes, within the stated 256-input-digit limit. The integer operations use exact integer arithmetic rather than converting through an ordinary floating-point number. For decimal-to-binary conversion, enter the decimal integer as text so every digit is available to the parser. API clients should also send quoted strings for large integer operands.
The complete result, place-value ledger and CSV preserve exact integer strings. A spreadsheet can still round a long integer after import, so choose text columns when retaining all digits matters. Fractional input, bitwise logic, fixed-width overflow and two’s-complement decoding are separate tasks outside this calculator’s model.
When is a Binary Calculator useful?
Use it to check base-two homework, inspect integer bit patterns or verify arithmetic before implementing a representation in code. The repeated-division table explains decimal-to-binary conversion: divide the magnitude by two and read the remainders from the final row upward.
For a network mask or a hardware field, width and interpretation still matter. The same printed bits can describe a positive magnitude, a signed machine value or several packed fields. Establish that context before applying a mathematical integer answer to a device or protocol.
Formula and calculation method
Base 2 uses place weights 2^k. Conversion changes notation, not numerical value. Inputs and integer results use exact BigInt arithmetic.
Integer division truncates toward zero. The remainder has the dividend’s sign and satisfies a = b × q + r with |r| < |b|.
Fractional division is separate from the integer quotient. Parentheses mark a detected repeat; an ellipsis marks the requested digit limit. No fixed word width, overflow wraparound or two’s-complement interpretation is assumed.
Scope and Limitations
- Signed integers only; at most 256 input digits per operand. Fractional input and fixed-width machine encodings are outside scope. Exact results are exported as strings; spreadsheets should import these columns as text.
Reference Sources
- Python documentation: integer conversion and number formatting
- ECMAScript: exact BigInt division and remainder
Frequently asked questions
Are 0b prefixes accepted?
Yes, for binary operands. A sign may appear before the prefix; conversion from decimal requires decimal digits instead.
Is the division result an integer or a fraction?
Both are shown separately: an integer quotient with remainder, and a fractional expansion limited to the requested number of places.
Does the calculator use two’s complement?
No. Signed inputs are mathematical integers with a separate minus sign, without a fixed word width.
Why are there parentheses in a quotient?
They mark a detected repeating block of fractional digits. An ellipsis instead marks a truncated preview.
Can I paste a binary fraction such as 10.1?
Not as an operand. Inputs are signed integers; fractional output can be produced by division.