{
    "name": "IPv4 to Integer Converter",
    "url": "https://calculators.geekmidst.com/calculators/ipv4-to-integer-converter",
    "markdown": "https://calculators.geekmidst.com/calculators/ipv4-to-integer-converter.md",
    "category": "IT, networking & security",
    "description": "Convert a dotted IPv4 address to its 32-bit integer, hexadecimal and binary forms, or turn an integer back into a dotted-quad IP address.",
    "summary": "An IPv4 address is a 32-bit number written as four bytes. Its integer value is a × 256³ + b × 256² + c × 256 + d, which is how databases and range lookups often store it.",
    "also_called": [
        "IP to decimal converter",
        "IP address to long converter"
    ],
    "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": "direction",
            "label": "Convert",
            "type": "segmented",
            "default": "to_int",
            "options": {
                "to_int": "IP → integer",
                "to_ip": "Integer → IP"
            }
        },
        {
            "name": "ip",
            "label": "IPv4 address",
            "type": "text",
            "default": "192.168.1.1",
            "shown_when": {
                "direction": "to_int"
            }
        },
        {
            "name": "integer",
            "label": "Integer",
            "type": "text",
            "default": "3232235777",
            "shown_when": {
                "direction": "to_ip"
            }
        }
    ],
    "outputs": [
        {
            "key": "result",
            "label": "Result",
            "format": "text"
        },
        {
            "key": "integer",
            "label": "Unsigned 32-bit integer",
            "format": "integer"
        },
        {
            "key": "ipv4",
            "label": "Dotted-quad address",
            "format": "text"
        },
        {
            "key": "hex",
            "label": "Hexadecimal",
            "format": "text"
        },
        {
            "key": "binary",
            "label": "Binary (by octet)",
            "format": "text"
        }
    ],
    "formula": {
        "text": "Integer = a × 16,777,216 + b × 65,536 + c × 256 + d;  a = ⌊n ÷ 2²⁴⌋ mod 256, b = ⌊n ÷ 2¹⁶⌋ mod 256, c = ⌊n ÷ 2⁸⌋ mod 256, d = n mod 256",
        "variables": {
            "a.b.c.d": "the four octets, each 0–255",
            "n": "the integer, 0 to 4,294,967,295"
        }
    },
    "worked_example": {
        "inputs": {
            "direction": "to_int",
            "ip": "192.168.1.1",
            "integer": "3232235777"
        },
        "steps": [
            "192 × 16,777,216 = 3,221,225,472; 168 × 65,536 = 11,010,048.",
            "1 × 256 = 256 and the last octet is 1.",
            "Sum = 3,232,235,777 = 0xC0A80101."
        ],
        "result": "192.168.1.1 is the integer 3,232,235,777, or 0xC0A80101 in hex."
    },
    "interpretation": "Storing addresses as unsigned integers makes range checks simple: an address is in a block if its integer lies between the block’s first and last address.",
    "assumptions": [
        "Octets are written in decimal; leading zeros are rejected because some software reads them as octal."
    ],
    "limitations": [
        "Signed 32-bit integer columns cannot hold addresses from 128.0.0.0 upwards; use an unsigned or 64-bit type."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "Why do some tools show a negative number?",
            "answer": "They store the value as a signed 32-bit integer. Add 4,294,967,296 to a negative value to get the unsigned form shown here."
        },
        {
            "question": "Does this work for IPv6?",
            "answer": "No. IPv6 addresses are 128-bit; use the IPv6 Address Compression Calculator for their text forms."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "IP Subnet Calculator",
            "url": "https://calculators.geekmidst.com/calculators/ip-subnet-calculator"
        },
        {
            "name": "IPv6 Address Compression Calculator",
            "url": "https://calculators.geekmidst.com/calculators/ipv6-address-compression-calculator"
        },
        {
            "name": "Binary Calculator",
            "url": "https://calculators.geekmidst.com/calculators/binary-calculator"
        },
        {
            "name": "Hex Calculator",
            "url": "https://calculators.geekmidst.com/calculators/hex-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}