What is URL Encoding (Percent-Encoding)?

URL encoding replaces characters that are unsafe in a URL with a percent sign followed by their hexadecimal byte value, so links stay valid.

URL encoding, formally called percent-encoding, is the process of converting characters that have special meaning or are unsafe in a URL into a percent sign followed by two hexadecimal digits representing the character's byte value. A space becomes %20, an ampersand becomes %26, and a question mark becomes %3F. This ensures a URL remains unambiguous even when it contains characters that would otherwise break its structure.

URLs reserve certain characters for structural roles: the question mark starts a query string, the ampersand separates parameters, the hash marks a fragment, and the slash separates path segments. If those characters appear inside a value — say a search term containing an ampersand — they must be encoded so the browser and server do not misinterpret them as structure.

Encoding also handles non-ASCII and unsafe characters. Spaces, accented letters, emoji, and symbols are first converted to their UTF-8 bytes, then each byte is percent-encoded. This is why a URL with a space often shows %20 and why international characters expand into multiple percent sequences. Getting this right keeps links working when shared across email, chat, and social platforms.

In marketing and analytics, correct URL encoding is essential for UTM parameters and query strings. A campaign name with a space or ampersand that is not encoded can truncate the value or break tracking entirely. Encoding a value before adding it to a URL, and decoding it to read what a link actually contains, are everyday tasks when auditing tracked links.

Examples

  • A space encodes to %20 (or + in the query string of some systems)
  • 'coffee & tea' becomes coffee%20%26%20tea inside a parameter value
  • utm_campaign=spring%20sale keeps the space from breaking the URL

Frequently asked questions

Free tools for working with URL Encoding (Percent-Encoding)

Related terms