Skip to tools
3 min read·

URL encoding explained: why %20 appears in links

Learn when URLs need encoding, what percent-encoding does, and how to avoid broken query strings and shared links.

URL encoding Web development API

Why URLs need special handling

A URL has reserved characters with structural jobs: ? begins a query string, & separates parameters, and # introduces a fragment. If those characters are part of a search term, filename or API value, they must be encoded so the browser and server read the URL correctly.

What percent-encoding means

Percent-encoding represents a character as a percent sign followed by its byte value in hexadecimal. A space commonly becomes %20, an ampersand becomes %26, and a slash becomes %2F when it is data rather than part of a path. This makes the value safe to send inside a URL.

Encode values, not the whole address

Keep the URL structure readable and encode individual parameter values. For example, encode the value in ?q=summer sale & shoes, rather than encoding the question mark and equals sign that make the query work. Double-encoding an already encoded value is another common source of confusing links.

Check a URL before you share it

Use the URL Encode and URL Decode tools to convert values in either direction. They are especially useful when debugging API requests, redirect links and query parameters copied from logs.

Try it in Code Formatter Pro

Every tool mentioned in this article runs entirely inside your browser — no signup, no uploads.

Open the toolkit