Skip to content
ProfitTool
Back to all articles
Developer Tools
1 min read

Why URLs Contain Percent Signs: Percent-Encoding Explained

%20, %2F and %40 are not errors — they are characters encoded so they survive a URL. What the common codes mean, and when a literal % must be escaped too.

ProfitTool Team

Developer Tools

What Percent-Encoding Is

A URL can only contain a restricted set of characters: letters, digits, and a handful of symbols (-._~:/?#[]@!$&'()*+,;=). Any other character must be encoded as a percent sign followed by two hexadecimal digits representing the character's UTF-8 byte value.

Common Percent-Encoded Characters

CharacterEncodedWhere it appears
Space%20Search queries: q=hello%20world
@%40Emails in URLs, database connection strings
/%2FForward slash when used as data (not path separator)
?%3FQuestion mark when used as data
&%26Ampersand in query values
=%3DEquals sign in query values
+%2BLiteral plus (+ is used for spaces in forms)
#%23Hash sign when used as data
%%25Literal percent sign
:%3AColon in query values

Why Your @ in a Password Breaks URLs

If your database password contains @, a connection string like:

postgresql://user:p@ss@host/db

Is ambiguous — the parser does not know which @ separates the credentials from the host. Encode it as %40:

postgresql://user:p%40ss@host/db

This is exactly why the Shahjahan78900@ password in a DATABASE_URL must be written as Shahjahan78900%40.

Plus Sign vs %20

In application/x-www-form-urlencoded (standard HTML form submission), spaces are encoded as +. In standard percent-encoding (URLs), spaces are %20. Both are correct in their contexts — mixing them up causes decoding errors.

Use our URL Encoder / Decoder to safely encode any string for use in URLs.

Tags:#url encoding#percent encoding#url#developer tools

ProfitTool Team

Developer Tools

Written and maintained by the ProfitTool team. Where an article references a ProfitTool utility, the behaviour described is the behaviour of the tool on this site — you can open it and check the output yourself.