CodePersia

URL Encoder & Decoder Online — Encode URLs & Query Parameters

Tool processing happens entirely in your browser. Your input is never sent to our servers.

Mode:
Output will appear here...

URL Encoding Explained

URL encoding (percent-encoding) replaces unsafe characters in URLs with a percent sign followed by two hexadecimal digits representing the character's byte value. For example, a space becomes %20, an ampersand becomes %26, and a forward slash becomes %2F.

Why URL encoding exists: URLs can only contain a limited set of ASCII characters. Characters like spaces, quotes, angle brackets, and many Unicode characters are not allowed in URLs. Encoding makes any string safe for inclusion in a URL.

encodeURI vs encodeURIComponent — knowing the difference:

  • encodeURI("https://example.com/path?q=hello world") → preserves the URL structure, only encodes the space
  • encodeURIComponent("hello world&more") → encodes everything including & and = → suitable for query parameter values

The URL parser in this tool breaks any URL into its components: protocol, host, port, pathname, query parameters (as key-value pairs), and fragment. This is invaluable for debugging complex URLs with multiple parameters.

The query string builder lets you construct properly encoded query strings from key-value pairs, handling all the encoding automatically. No more manually concatenating parameters and worrying about missing encoding.

For encoding binary data in text format, see the Base64 Encoder/Decoder. If you are working with JSON data in URLs, the JSON Formatter can help you inspect the payload structure.

How to Use This URL Encoder/Decoder

  1. Paste or type your input in the editor above
  2. Click the action button or the tool will process automatically
  3. View the result in the output panel
  4. Copy the result with one click using the Copy button

Frequently Asked Questions

encodeURI encodes a full URL but preserves characters that have meaning in URLs (like /, ?, #, &). encodeURIComponent encodes everything except letters, digits, and a few safe characters — use this for individual query parameter values.

URL encode whenever you include user input or dynamic values in URLs. Query parameter values, path segments with special characters, and any text that might contain spaces or symbols need encoding.

Yes. encodeURIComponent correctly handles all Unicode characters by converting them to their UTF-8 percent-encoded equivalents.