encoding a query string
- Text
- search?q=tax rate&year=2026
- Direction
- Encode
- Encode
- A component, encoding reserved characters
Resultsearch%3Fq%3Dtax%20rate%26year%3D2026
The component function escapes ? = & and the space
Open this exampleURL encoding and decoding, with the component and whole-URI variants separated. Encoding a whole URL with the component function breaks it, because that function escapes the slashes and colons that make it a URL.
Also called: percent encoding, uri encoder.
search%3Fq%3Dtax%20rate%26year%3D2026. 5 characters were changed of 27. The component function escapes reserved characters including slashes and colons, which is right for a value and wrong for a whole URL.
Percent encoding replaces reserved and unsafe characters with a percent sign and their hexadecimal byte value. The distinction between the two functions is the one that causes bugs: the component function escapes everything reserved, including the slashes, colons and ampersands that give a URL its structure, which is correct for a query parameter value and wrong for a whole address. The URI function preserves those, which is correct for a whole URL and insufficient for a value being placed into one.
reserved and unsafe characters become a percent sign and their hex byte valueEach of these is asserted on every build. If a change to the engine ever moved one of these answers, the build would fail before the page could print it.
Resultsearch%3Fq%3Dtax%20rate%26year%3D2026
The component function escapes ? = & and the space
Open this exampleResultsearch?q=tax%20rate&year=2026
boundary: only the space is escaped
Open this exampleFormula version 1.0.0 · definition 1.0.0 · India · Report a problem with this calculator