🛠️ Other ToolsFree · No signup

URL Encoder / Decoder

Encode special characters in URLs using percent-encoding (RFC 3986) or decode encoded URL strings. Essential for web development, API work, and link sharing.

Input

21 chars

Output

31 chars

About the URL Encoder / Decoder

A URL encoder and decoder converts special characters and non-ASCII text to and from percent-encoding — the standard format defined by RFC 3986 for safely including arbitrary characters in URLs. Percent-encoding replaces each byte of a character that is not in the "unreserved" set (A-Z, a-z, 0-9, -, _, ., ~) with a percent sign followed by the two-digit hexadecimal value of that byte. For example, a space becomes %20, & becomes %26, and the euro sign (€, UTF-8: E2 82 AC) becomes %E2%82%AC. This encoding is essential whenever user-provided text (names, search queries, addresses) is incorporated into a URL, because unencoded special characters can break URL parsing or create security vulnerabilities like parameter injection. Web frameworks and HTTP libraries handle encoding automatically in most cases, but developers still need to understand and manually decode or encode URLs when debugging, building custom queries, or parsing URLs outside of standard frameworks. This tool is used by web developers, backend engineers, SEO professionals, and API developers.

Formula

Reserved chars: : / ? # [ ] @ ! $ & ' ( ) * + , ; = | Unreserved: A-Z a-z 0-9 - _ . ~ | All others: %XX (hex byte)

How It Works

JavaScript provides two encoding functions: encodeURI(url) preserves characters with special URL meaning (: / ? # [ ] @ ! $ & ' ( ) * + , ; =). Use for encoding a complete URL where structural characters must be preserved. encodeURIComponent(value) also encodes those structural characters — use for individual query parameter values. Example: encodeURIComponent("hello world&name=Bob") → "hello%20world%26name%3DBob". The full URL "https://example.com/search?q=hello world&filter=price>10" encoded correctly: only the values are encoded → "https://example.com/search?q=hello%20world&filter=price%3E10". Decoding: decodeURIComponent("%E2%82%AC") → "€". UTF-8 multi-byte characters: each byte is encoded separately — the euro sign (3 UTF-8 bytes) produces three percent-encoded triplets.

Tips & Best Practices

  • Always encode query parameter values individually before joining with & — do not encode the full query string after assembly. Encoding the entire string will encode the structural & and = characters, breaking the parameter parsing.
  • Double-encoding is a common bug: if a value is already percent-encoded and you encode it again, %20 becomes %2520 (the % is itself encoded as %25). Always decode first if you are uncertain whether a value is already encoded, then re-encode cleanly.
  • Path segments vs query parameters use slightly different encoding rules. In path segments, / must be encoded as %2F if it is data (not a path separator). In query strings, + traditionally represents a space (form encoding, RFC 1866) in addition to %20 — modern APIs prefer %20 for clarity.
  • For SEO purposes, URLs with readable words in the path (/categories/running-shoes/) rank better than URLs with encoded characters (/categories/running%20shoes/) or opaque identifiers. Use hyphens rather than spaces in URL paths; properly handle encoding only in query parameters where arbitrary user input is needed.

Who Uses This Calculator

Web and backend developers debugging URL encoding issues in API requests and query strings. SEO professionals analysing and correcting URL encoding in site audits. Frontend developers encoding user input for safe inclusion in dynamically constructed URLs. API integrators inspecting encoded webhook payloads, redirect URLs, and OAuth callback parameters.

Optimised for: USA · UK · Canada · Australia · Calculations run in your browser · No data stored

Frequently Asked Questions

Why do URLs need encoding?

URLs can only contain a limited set of ASCII characters. Special characters like spaces, &, =, ?, #, and non-ASCII characters must be percent-encoded as %XX (where XX is the hex code). For example, a space becomes %20, & becomes %26, and the euro symbol becomes %E2%82%AC.

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a complete URL and preserves characters like /, :, ?, &, = that have meaning in URL structure. encodeURIComponent encodes a URL component (like a query parameter value) and also encodes these structural characters. Use encodeURIComponent for individual parameter values in query strings.

When should I URL encode data?

Always URL-encode query parameter values that might contain special characters, spaces, or non-ASCII text. When building API requests programmatically, use your language URL encoding functions (urllib.parse.quote in Python, encodeURIComponent in JavaScript). This prevents broken requests and potential security issues.