# URL encode and decode > How do you encode text for a web address? Percent-encode text for a web address, or decode %20 and friends back to plain text. Encode text for a URL or decode percent-encoded text. Choose a whole address, one part of it or form data, and see exactly where invalid escapes are. - Page: https://how.box/url-encode/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/url-encode/?dir={dir}&scope={scope}&text={text} - `dir` (encode or decode): encode or decode. Example: `encode`. - `scope` (component, full or form): component (part of an address), full (whole address) or form (form data). Example: `component`. - `text` (text): The text to encode, or the percent-encoded text to decode. Example: `Hello world & café?`. Example answer: https://how.box/url-encode/?dir=encode&scope=component&text=Hello+world+%26+caf%C3%A9%3F The page computes the answer in the browser: read results from the agent tools below, not from the page HTML. ## Agent tools - `url_encode_convert`: Percent-encodes text for use in a web address, or decodes percent-encoded text (RFC 3986 §2.1, UTF-8). - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"url_encode_convert","arguments":{"direction":"encode","scope":"component","text":"Hello world & café?"}}}` - GET: https://how.box/mcp/run/url_encode_convert?direction=encode&scope=component&text=Hello+world+%26+caf%C3%A9%3F ## How it works A web address can only hold a small set of characters. Anything else, such as a space, an accent, an emoji, or a character that has a special meaning like ? and &, is written as a percent sign and two hex digits for each byte: a space becomes %20 and é becomes %C3%A9. Text is turned into bytes as UTF-8 first (RFC 3986, section 2.1). What to leave alone depends on where the text goes. For one piece of an address, such as a search term in a query, everything with a meaning is escaped, so an & in your text cannot be mistaken for the start of the next parameter. For a whole address, the characters that structure it, such as / ? & = and #, are kept so the address still works. Form data is like a piece of an address, except that a space is written as + (ECMAScript encodeURIComponent and encodeURI; WHATWG URL Standard). Decoding needs a valid code. A % without two hex digits after it, or escapes that are not valid UTF-8, cannot be turned back into text, and the tool says where the problem starts. Encoding is not encryption: anyone can decode the result. ## FAQ **Should I encode the whole address or just a part?** Encode just the part you are inserting, such as a search term or a file name. Encoding a whole address as a part would also escape its slashes and colons and break it. **What is the difference between %20 and +?** Both can mean a space. %20 works everywhere in an address. + means a space only in form data and many query strings, so a real plus sign has to be written %2B. **Why does decoding say my text is invalid?** Usually a stray % sign, such as in 100% sure, or a half-copied code like %E2%82. Write a literal percent sign as %25. **Does encoding hide sensitive information in a URL?** No. Percent-encoding is reversible. It does not encrypt a password or token. **Why does an encoded percent sign become %25?** The percent sign introduces an escape. Encoding it as %25 lets the decoder distinguish a literal percent sign from an escape sequence. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)