{
    "name": "URL Encoder and Decoder",
    "url": "https://calculators.geekmidst.com/calculators/url-encoder-decoder",
    "markdown": "https://calculators.geekmidst.com/calculators/url-encoder-decoder.md",
    "category": "IT, networking & security",
    "description": "Percent-encode text for use in a URL query or path, or decode %XX sequences back to readable text, with UTF-8 and form (+ for space) modes.",
    "summary": "URLs may contain only a limited set of characters. Everything else is percent-encoded: each UTF-8 byte becomes % followed by two hex digits, so a space becomes %20 and é becomes %C3%A9.",
    "also_called": [
        "Percent-encoding tool",
        "URL escape tool"
    ],
    "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": "mode",
            "label": "Action",
            "type": "segmented",
            "default": "encode",
            "options": {
                "encode": "Encode",
                "decode": "Decode"
            }
        },
        {
            "name": "scope",
            "label": "Encoding for",
            "type": "select",
            "default": "component",
            "options": {
                "component": "A query value or path segment (RFC 3986)",
                "form": "An HTML form value (space as +)",
                "uri": "A whole URL (keep : / ? & = #)"
            }
        },
        {
            "name": "text",
            "label": "Text",
            "type": "textarea",
            "default": "café & crème = 100%"
        }
    ],
    "outputs": [
        {
            "key": "result",
            "label": "Result",
            "format": "text"
        },
        {
            "key": "changed",
            "label": "Length",
            "format": "text"
        }
    ],
    "formula": {
        "text": "Keep A–Z a–z 0–9 - . _ ~; replace every other character by the %XX hex code of each of its UTF-8 bytes.",
        "variables": {
            "%XX": "a byte value in hexadecimal, e.g. space = %20, & = %26, é = %C3%A9"
        }
    },
    "worked_example": {
        "inputs": {
            "mode": "encode",
            "scope": "component",
            "text": "a b&c=d"
        },
        "steps": [
            "Letters a, b, c, d are unreserved and stay as they are.",
            "Space → %20, & → %26, = → %3D."
        ],
        "result": "\"a b&c=d\" encodes to a%20b%26c%3Dd, safe to use as a single query value."
    },
    "interpretation": "Encode each query value separately, then join them with & and =. Encoding a whole URL with the component option would also escape the : / ? characters that give the URL its structure.",
    "assumptions": [
        "UTF-8 encoding, as specified for URLs by RFC 3986 and the WHATWG URL standard."
    ],
    "limitations": [
        "The whole-URL option leaves reserved characters such as & and = untouched, so it cannot tell a literal & in a value from a separator."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "Should a space be %20 or +?",
            "answer": "Both appear. %20 is correct anywhere in a URL; + means space only in form-encoded query strings (application/x-www-form-urlencoded)."
        },
        {
            "question": "Why did decoding fail?",
            "answer": "A % must be followed by two hex digits, and the bytes must form valid UTF-8. A stray % in the text should itself be encoded as %25."
        }
    ],
    "sources": [
        {
            "title": "RFC Editor (RFC 3986: Uniform Resource Identifier, Generic Syntax)",
            "url": "https://www.rfc-editor.org/"
        }
    ],
    "related": [
        {
            "name": "Base64 Encoder and Decoder",
            "url": "https://calculators.geekmidst.com/calculators/base64-encoder-decoder"
        },
        {
            "name": "Website Bandwidth Calculator",
            "url": "https://calculators.geekmidst.com/calculators/bandwidth-calculator"
        },
        {
            "name": "Roman Numeral Converter",
            "url": "https://calculators.geekmidst.com/calculators/roman-numeral-converter"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}