URL Encoding Guide: What It Is and How to Encode URLs Online
Understand URL encoding (percent-encoding) — why special characters break URLs, which characters must be encoded, and how to encode/decode URLs instantly.
What is URL Encoding?
URL encoding (also called percent-encoding) is the process of converting characters that are not allowed in URLs into a safe format. Each unsafe character is replaced by a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code.
For example, a space becomes %20, and an ampersand becomes %26.
Why Do URLs Need Encoding?
URLs can only contain a limited set of characters defined by the URI specification (RFC 3986). Characters outside this set — including spaces, non-ASCII characters, and many punctuation marks — have special meaning or would break URL parsing. Without encoding, a URL containing a search query like Hello World & More would be ambiguous or invalid.
Which Characters Must Be Encoded?
Characters are divided into three groups:
- Reserved characters — have special meaning in URLs (
: / ? # [ ] @ ! $ & ' ( ) * + , ; =). Encode these when they appear as data values, not URL structure. - Unreserved characters — always safe to use as-is (
A–Z a–z 0–9 - _ . ~) - Everything else — must be percent-encoded, including spaces, non-ASCII characters, and special symbols
URL Encoding vs encodeURI vs encodeURIComponent
JavaScript provides two built-in functions for this:
encodeURI()— encodes a full URL but preserves reserved characters like://?&=encodeURIComponent()— encodes everything including reserved characters; use this for query parameter values
To encode a query parameter value safely: encodeURIComponent("hello world & more") → hello%20world%20%26%20more
Common Encoded Characters
- Space →
%20(or+in form data) &→%26=→%3D+→%2B/→%2F?→%3F#→%23
How to Encode / Decode a URL Online
- Open the ToolsPal URL Encoder
- Paste your URL or query parameter value in the input
- Encoded output appears instantly on the right
- Switch to Decode to convert percent-encoded text back to readable form
Free Online Tool
Try URL Encoder/Decoder
Encode or decode URLs and query string parameters.