LowercaseOnline — Free Online Text Tools

URL Encoder

Percent-encode special characters for safe use in URLs and query strings.

What Is URL Encoding?

URL encoding (also called percent-encoding) converts characters that are not safe to appear in a URL into a % followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20, and an ampersand becomes %26.

This is necessary because URLs can only contain a limited set of ASCII characters. Any other character — including non-ASCII Unicode, spaces, and reserved punctuation — must be encoded before being placed in a URL.

encodeURIComponent vs encodeURI

This tool uses encodeURIComponent(), which is the correct function for encoding individual query string values or path segments. It encodes all characters except: A–Z a–z 0–9 - _ . ! ~ * ' ( ).

The related function encodeURI() is intended for encoding a complete URL and deliberately leaves URL structural characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) un-encoded. Use encodeURIComponent (this tool) when encoding a value that will be placed inside a query string.

Common Encoded Characters

CharacterEncodedDescription
Space%20Word separator
&%26Query string separator
=%3DKey=value separator
+%2BSometimes used as space in forms
#%23Fragment identifier
?%3FQuery string start
/%2FPath separator
:%3AProtocol / port separator
@%40Userinfo separator
%%25The percent sign itself

When to Use URL Encoding

Encode values before appending them to a URL in code: url + '?q=' + encodeURIComponent(searchTerm). Without encoding, a search term containing & or = would break the query string structure. URL encoding is also required for form submission values, redirect URLs passed as parameters, and any non-ASCII text in URLs.

Need more encoding tools? Try the full Encode & Decode suite.