{
    "name": "Hex Calculator",
    "url": "https://calculators.geekmidst.com/calculators/hex-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/hex-calculator.md",
    "category": "Algebra, geometry & advanced math",
    "description": "Add, subtract, multiply, divide and do bitwise AND, OR and XOR on hexadecimal numbers, with results in hex, decimal and binary.",
    "summary": "Enter two hexadecimal numbers (0–9 and A–F) and an operation. The answer is exact and also shown in decimal and binary.",
    "also_called": [
        "Hexadecimal calculator",
        "Base-16 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 hex number",
            "type": "text",
            "default": "FF"
        },
        {
            "name": "op",
            "label": "Operation",
            "type": "select",
            "default": "+",
            "options": {
                "+": "Add (+)",
                "-": "Subtract (−)",
                "*": "Multiply (×)",
                "/": "Divide (÷, whole-number)",
                "and": "AND",
                "or": "OR",
                "xor": "XOR"
            }
        },
        {
            "name": "b",
            "label": "Second hex number",
            "type": "text",
            "default": "1"
        }
    ],
    "outputs": [
        {
            "key": "result",
            "label": "Result (hex)",
            "format": "text"
        },
        {
            "key": "decimal",
            "label": "Result in decimal",
            "format": "text"
        },
        {
            "key": "other",
            "label": "Result in binary",
            "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ᵢ × 16ⁱ, with digits 0–9 and A = 10, B = 11, C = 12, D = 13, E = 14, F = 15;  the operation is done on the exact integers",
        "variables": {
            "dᵢ": "the hex digit in position i, counted from 0 at the right"
        }
    },
    "worked_example": {
        "inputs": {
            "a": "FF",
            "op": "+",
            "b": "1"
        },
        "steps": [
            "FF = 15 × 16 + 15 = 255.",
            "255 + 1 = 256 = 1 × 16², which is 100 in hex.",
            "In binary, 256 = 2⁸ = 100000000."
        ],
        "result": "FF + 1 = 100 in hexadecimal, or 255 + 1 = 256 in decimal."
    },
    "interpretation": "Each hex digit stands for exactly four bits, which is why hex is used for memory addresses, colour codes (#FF8800) and byte values.",
    "assumptions": [
        "Inputs are unsigned hexadecimal integers; upper or lower case and a 0x prefix are accepted."
    ],
    "limitations": [
        "Negative results are shown with a minus sign, not in two’s complement.",
        "Division gives a whole-number quotient and a remainder."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "How do I convert hex to decimal?",
            "answer": "Multiply each digit by a power of 16 from the right (1, 16, 256, 4096, …) and add. 1A = 1 × 16 + 10 = 26."
        },
        {
            "question": "Why is one byte two hex digits?",
            "answer": "A byte has 8 bits and each hex digit encodes 4 bits, so 00 to FF covers all 256 byte values."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Binary Calculator",
            "url": "https://calculators.geekmidst.com/calculators/binary-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"
}