decodeurl.com

Article

BLOG

What URL Encoding Actually Does

A practical answer to what URL encoding means, when to use it, and how percent-encoded text keeps links from breaking.

URL encoding is the way a URL carries text that would otherwise be unsafe or ambiguous. Browsers, servers, analytics tools, and APIs all rely on the same basic idea: write unsafe bytes as a percent sign followed by two hexadecimal digits.

If you only need to turn readable text into a safe URL value, open the URL Encode tool. If you are trying to read an already encoded link, use the URL Decode tool.

What is URL encoding?

URL encoding, also called percent-encoding, converts characters that are unsafe in a URL into a portable %XX form. A space becomes %20, an ampersand becomes %26, and non-ASCII text is converted to UTF-8 bytes before each byte is encoded.

Why do URLs need encoding?

URLs need encoding because characters such as spaces, &, =, ?, and # can either be invalid or have structural meaning. If those characters appear inside user text without encoding, a browser or server may treat them as URL syntax instead of data.

Which characters are safe without encoding?

The safest unreserved characters are letters, digits, hyphen, underscore, period, and tilde: A-Z, a-z, 0-9, -, _, ., and ~. Reserved characters such as /, ?, &, and = can stay unencoded only when they are acting as URL structure.

What is an example of URL encoding?

The text paper flowers & tags=gift becomes paper%20flowers%20%26%20tags%3Dgift when encoded as a URL component. The encoded ampersand and equals sign remain part of the value instead of splitting the query string into new parameters.

Should I encode a whole URL or just part of it?

Usually you should encode individual URL parts, not the entire URL. Encode a search term, query parameter value, path segment, or redirect target before inserting it into a URL. Encoding the whole URL can turn https:// and / into data and break the link.

When should I use the encoder?

Use the URL Encode tool when you are building a link from text pasted by a person, a search term, an email address, a redirect URL, or any value that may contain spaces or reserved characters. Encoding first prevents accidental URL syntax.

When should I use the decoder?

Use the URL Decode tool when a link is already full of percent codes and you need to inspect what it really contains. Decoding is especially useful for tracking links, OAuth redirect URLs, and bug reports where the readable value is hidden.

What is the main rule to remember?

Encode exactly once when producing a URL component, and decode exactly once when reading it. Encoding or decoding repeatedly can change the meaning of the URL, especially when percent signs, ampersands, slashes, or plus signs are involved.

← Back to the blog