URL encoding (also called percent-encoding) converts characters that aren't allowed in URLs into a safe format. A space becomes %20, a question mark becomes %3F, and so on. This ensures that URLs with special characters, spaces, or non-ASCII text work reliably in every browser, email client, and server.
Without encoding, a URL like search?q=hello world would break because the space is an invalid character. Properly encoded, it becomes search?q=hello%20world and works everywhere.
Which Characters Get Encoded
- Reserved characters -
:,/,?,#,[,],@,!,$,&,',(,),*,+,,,;,=are encoded when they're part of data rather than URL structure. - Unsafe characters - Spaces, quotes,
<,>,{,},|,\,^,~,[,],`are always encoded. - Non-ASCII characters - UTF-8 encoded bytes are percent-encoded. For example,
ébecomes%C3%A9.
When You Need URL Encoding
- Building query strings - When adding parameters to a URL, always encode the values
- Debugging API calls - Decode encoded URLs to inspect what data is being sent
- Marketing links - UTM parameters with spaces or special chars must be encoded
- Form submissions - Browsers encode form data automatically, but manually building URLs requires it
Watch Out for Double Encoding
A common bug is encoding an already-encoded URL. If %20 gets encoded again, it becomes %2520 (the % itself gets encoded as %25). This usually breaks the URL. Use the decode function to check if something has been double-encoded.
Privacy First
All encoding and decoding happens locally in your browser. Your URLs never leave your device.