URL Encoder & Decoder Online — Free URL Encode/Decode Tool

Output
Output will appear here...

URL Components Breakdown

protocolhttps:
hostexample.com
pathname/search
search?q=hello%20world&lang=it&tag=c++%20developer
hash
query params{"q":"hello world","lang":"it","tag":"c developer"}

URL Encoding: Why and How

A URL can only contain a limited set of ASCII characters. Characters outside this set — spaces, accented letters, symbols like & = ? # — must be percent-encoded: replaced with %XX where XX is the hexadecimal UTF-8 byte value. For example, a space becomes %20, and becomes %E2%82%AC (three UTF-8 bytes).

🔍 encodeURI vs encodeURIComponent

These are two different functions in JavaScript — choosing the wrong one is a common source of bugs:

FunctionDoes NOT encodeUse for
encodeURIA–Z a–z 0–9 - _ . ! ~ * ' ( ) ; , / ? : @ & = + $ #Encoding a complete URL — preserves URL structure
encodeURIComponentA–Z a–z 0–9 - _ . ! ~ * ' ( )Encoding a single query parameter value — encodes :/?#&=+

Example — encoding a redirect parameter:

encodeURI — preserves URL structure
Input: https://example.com?redirect=https://other.com/path?foo=bar
Output: https://example.com?redirect=https://other.com/path?foo=bar
⚠ Nothing encoded — the redirect value is still ambiguous to the server
encodeURIComponent — encodes the value
Input: https://other.com/path?foo=bar
Output: https%3A%2F%2Fother.com%2Fpath%3Ffoo%3Dbar
✓ Safe to embed as a query parameter value inside another URL

🔗 URL Structure

A URL has well-defined components, each with its own encoding rules:

https://user:[email protected]:8080/path/to/page?key=value&foo=bar#section
scheme authority (userinfo@host:port) path query fragment

⚠️ Common Pitfalls

All encoding and decoding runs locally in your browser. No data is sent anywhere.

Related Tools