linkutm Logo
Glossary Term

URL Encoding

URL Encoding URL encoding is the process of converting characters into a format that can be transmitted safely over the

glossary url encoding featured

URL encoding is the process of converting characters into a format that can be transmitted safely over the Internet. It replaces unsafe or reserved characters with a percent sign followed by two hexadecimal digits. URL encoding is also called percent encoding, because every encoded character starts with a %.

URLs can only contain a limited set of ASCII characters. Any character outside that set, including spaces, accents, and many symbols, must be encoded before it travels in a web address. The standard is defined in RFC 3986.

Why URL Encoding Matters

URL encoding prevents links from breaking when they contain characters a browser or server cannot interpret directly.

A space is the clearest example. A raw space in a URL ends the address as far as many systems are concerned. Encoding it as %20 keeps the link intact. The same applies to ampersands, question marks, and slashes inside a value, because each of those has a special structural meaning in a URL.

For marketers, encoding matters most inside query strings. Campaign values often contain spaces or symbols. Without encoding, a UTM parameter like utm_campaign=summer sale can split or get truncated, sending broken data into Google Analytics.

How URL Encoding Works

URL encoding takes the byte value of a character and writes it as % plus its two-digit hexadecimal code.

The process follows three steps:

  1. Identify unsafe characters. Any character that is reserved, unsafe, or outside the unreserved ASCII set gets flagged.
  2. Convert to bytes. The character is encoded as one or more bytes using UTF-8.
  3. Write each byte as hex. Every byte becomes a % followed by its hexadecimal value.

A space (byte value 32, hex 20) becomes %20. An at sign @ becomes %40. Non-ASCII characters use multiple bytes, so the euro sign becomes %E2%82%AC, its three UTF-8 bytes encoded in sequence.

https://example.com/search?q=red%20shoes&brand=nike%26co

Here the space in red shoes is %20, and the literal ampersand in nike&co is %26, so it is not mistaken for a parameter separator.

URL Encoding Characters

Characters fall into two groups under RFC 3986. Knowing which is which tells you what gets encoded.

  • Unreserved characters. Letters A-Z and a-z, digits 0-9, and the four symbols - _ . ~. These are never encoded.
  • Reserved characters. Symbols with structural meaning, such as : / ? # [ ] @ & = +. These are encoded when used as data rather than as delimiters.

Everything else, including spaces and non-ASCII characters, is always encoded. One common source of confusion is the plus sign. In form submissions (application/x-www-form-urlencoded), a space is encoded as +. In the path or a standard query, a space is %20.

How to Encode and Decode a URL

Most programming languages include built-in functions for encoding. JavaScript offers two, and the difference matters.

  • encodeURIComponent() encodes reserved characters like &, =, and /. Use it for individual parameter values.
  • encodeURI() leaves those structural characters intact. Use it for a full URL you do not want to break.

For a quick manual check, paste a value into linkutm’s URL encoder and decoder to see the encoded and decoded versions side by side. Decoding reverses the process: each % sequence is converted back to its original character.

Frequently Asked Questions

What is URL encoding?

URL encoding is a method of converting characters into a format that transmits safely in a web address. It replaces unsafe characters with a percent sign and two hexadecimal digits, such as %20 for a space. It is also called percent encoding.

What does URL encoding mean for a space?

A space is encoded as %20 in a URL path or query string. In form data submitted as application/x-www-form-urlencoded, a space is encoded as a plus sign (+) instead. Both decode back to a single space.

What is the difference between URL encoding and percent encoding?

There is no difference. Percent encoding is the technical name from RFC 3986, and URL encoding is the common term for the same process. Both describe replacing characters with % plus hexadecimal digits.

Which characters need to be URL encoded?

Reserved characters such as & ? / # = need encoding when used as data, along with spaces and any non-ASCII character. Unreserved characters, the letters, digits, and the symbols - _ . ~, are never encoded.

To encode or decode a value instantly, use the free URL encoder and decoder at linkutm.