{
    "name": "Binary Calculator",
    "url": "https://calculators.geekmidst.com/calculators/binary-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/binary-calculator.md",
    "category": "Algebra, geometry & advanced math",
    "description": "Do arithmetic and bitwise operations on binary numbers of any length, with the answer in binary, decimal and hexadecimal.",
    "summary": "Enter two binary numbers and an operation. Arithmetic is exact for numbers up to 256 bits, and every answer is also shown in decimal and hex.",
    "also_called": [
        "Base-2 calculator"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "a",
            "label": "First binary number",
            "type": "text",
            "default": "1011"
        },
        {
            "name": "op",
            "label": "Operation",
            "type": "select",
            "default": "+",
            "options": {
                "+": "Add (+)",
                "-": "Subtract (−)",
                "*": "Multiply (×)",
                "/": "Divide (÷, whole-number)",
                "and": "AND",
                "or": "OR",
                "xor": "XOR"
            }
        },
        {
            "name": "b",
            "label": "Second binary number",
            "type": "text",
            "default": "110"
        }
    ],
    "outputs": [
        {
            "key": "result",
            "label": "Result (binary)",
            "format": "text"
        },
        {
            "key": "decimal",
            "label": "Result in decimal",
            "format": "text"
        },
        {
            "key": "other",
            "label": "Result in hexadecimal",
            "format": "text"
        },
        {
            "key": "remainder",
            "label": "Remainder (division only)",
            "format": "text"
        },
        {
            "key": "a_decimal",
            "label": "First number in decimal",
            "format": "text"
        },
        {
            "key": "b_decimal",
            "label": "Second number in decimal",
            "format": "text"
        }
    ],
    "formula": {
        "text": "Value = Σ dᵢ × 2ⁱ (digits dᵢ = 0 or 1, i counted from 0 at the right);  the operation is done on the exact integers and converted back to base 2",
        "variables": {
            "dᵢ": "the binary digit (bit) in position i"
        }
    },
    "worked_example": {
        "inputs": {
            "a": "1011",
            "op": "+",
            "b": "110"
        },
        "steps": [
            "1011 = 8 + 2 + 1 = 11 and 110 = 4 + 2 = 6.",
            "11 + 6 = 17 = 16 + 1, which is 10001 in binary.",
            "In hexadecimal 17 = 1 × 16 + 1 = 0x11."
        ],
        "result": "1011 + 110 = 10001 in binary, which is 11 + 6 = 17 in decimal."
    },
    "interpretation": "Bitwise AND keeps a 1 only where both numbers have one, OR where either has one, and XOR where exactly one has one: the basis of masks and flags in programming.",
    "assumptions": [
        "Inputs are unsigned (non-negative) binary integers; a 0b prefix is accepted."
    ],
    "limitations": [
        "Negative results are shown with a minus sign, not in two’s complement.",
        "Division gives a whole-number quotient and a remainder; binary fractions are not supported."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "How do I convert binary to decimal by hand?",
            "answer": "Write the powers of 2 under the digits from the right (1, 2, 4, 8, …) and add the ones under a 1. For 1011: 8 + 0 + 2 + 1 = 11."
        },
        {
            "question": "Why does a computer use binary?",
            "answer": "Electronic circuits reliably distinguish two states, on and off, so every number is stored as a pattern of bits."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Hex Calculator",
            "url": "https://calculators.geekmidst.com/calculators/hex-calculator"
        },
        {
            "name": "Exponent Calculator",
            "url": "https://calculators.geekmidst.com/calculators/exponent-calculator"
        },
        {
            "name": "Log Calculator",
            "url": "https://calculators.geekmidst.com/calculators/log-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}