URL Encoding Explained: What %20 Actually Means
Paste a URL into a browser address bar and you'll often see something like https://example.com/search?q=hello%20world or a query string full of percent signs and two-digit hex codes. This is URL encoding — also called percent-encoding — and it exists for a specific technical reason that becomes obvious once you understand how URLs are parsed.
What Is URL Encoding?
URLs can only legally contain a defined set of characters: letters, digits, and a small handful of symbols (-, _, ., ~). Everything else — spaces, slashes, ampersands, non-ASCII characters — must be encoded before being placed in a URL.
The encoding scheme, defined in RFC 3986, works by replacing each unsafe character with a percent sign followed by the character's hexadecimal value in the UTF-8 character set. A space (ASCII 32, hex 0x20) becomes %20. A forward slash (hex 0x2F) becomes %2F. The at-sign (@) becomes %40. Non-ASCII characters like accented letters or emoji get encoded as their multi-byte UTF-8 sequences — an em dash (—) becomes %E2%80%94.
Common Percent-Encoded Characters
%20 — space (also sometimes represented as + in query strings, though this is technically form encoding, not RFC 3986).
%2F — forward slash / (important: an unencoded slash is a path separator; encoding it treats it as data, not structure).
%3F — question mark ? (separates the path from the query string; encoding it puts a literal question mark in a value).
%26 — ampersand & (separates query parameters; must be encoded inside a parameter value).
%3D — equals sign = (separates key from value in query parameters; must be encoded inside values).
Encode vs Decode: When You Need Each
Encoding is what you do when building a URL programmatically. If you're constructing a query string that contains user-supplied text — a search query, a product name, an address — you must encode it before appending it to the URL. Failing to do so will break the URL structure if the input contains &, =, ?, or /.
Decoding is what you do when reading a URL. An API response, server log, or browser history entry may contain percent-encoded text that you need to read as a human. Decoding turns %20 back into a space and %E9 back into é.
encodeURIComponent vs encodeURI in JavaScript
JavaScript provides two encoding functions that developers often confuse. encodeURIComponent() encodes everything except unreserved characters (letters, digits, -, _, ., !, ~, *, ', (, )). Use this for individual query parameter values.
encodeURI() does not encode characters that are valid URL structural components (/, ?, &, =, #, and others). Use this when you have a complete URL and want to encode only the non-ASCII portions without breaking its structure. For most query-string work, encodeURIComponent() is the right choice.
Our URL Encoder/Decoder handles both encoding and decoding instantly in your browser. Paste a raw URL or an encoded string and get the transformed result in one click. For encoding HTML special characters in markup, the HTML Entities tool covers the complementary use case.