Percent encoding
Also called URL encoding, percent-encoding
Percent encoding, also called URL encoding, writes reserved or non-ASCII characters in a URL as % followed by two hex digits, so a space becomes %20. In form data a space can also be written as +. JSON sent in a query string is often percent-encoded so braces, quotes and Unicode survive, and encoding it twice is a common bug.
In more detail
Percent-encoding, also called URL encoding, writes a byte as % followed by two hexadecimal digits. RFC 3986 defines it for URIs. Characters that have a meaning in a URL, such as / ? # & =, and any character outside plain ASCII are encoded when they appear as data.
Non-ASCII text is first turned into UTF-8 bytes, and each byte is encoded. So é becomes %C3%A9.
A space becomes %20 in a URL path. In HTML form data (application/x-www-form-urlencoded), which most query strings use, a space can also be written as +. That is why a literal + in a query value must be sent as %2B.
In JavaScript, encodeURIComponent encodes a single value, including / ? & and =. encodeURI encodes a whole URL and leaves those separators alone. Encoding a value twice turns % into %25, a common bug.
Example
encodeURIComponent("json tools & more/é") // "json%20tools%20%26%20more%2F%C3%A9"
encodeURI("https://example.com/a b?q=1") // "https://example.com/a%20b?q=1"
decodeURIComponent("%7B%22a%22%3A1%7D") // '{"a":1}'Try it
Learn more in the guide What is URL encoding? Percent-encoding, %20 and + explained.
← Back to Percent encoding in the JSON glossaryUpdated 2026-10-01