URL Encoder/Decoder

Encode or decode text for safe use in URL query strings and paths.

How to Use the URL Encoder/Decoder

  1. Enter text into the box (or paste a %-encoded string you want to decode).
  2. Click "Encode" to percent-encode special characters, or "Decode" to convert back to plain text.
  3. Click "Copy to Clipboard" to copy the result.

How Percent-Encoding Works

A URL can only carry a limited set of characters, and several of them have special jobs: ? starts the query string, & separates parameters, = joins a name to its value and # starts the fragment. To put any other character into a URL, or to use one of these characters as ordinary data, it is converted to its UTF-8 bytes and each byte is written as a percent sign followed by two hexadecimal digits.

This tool uses JavaScript's encodeURIComponent. It leaves only the letters A to Z and a to z, the digits 0 to 9 and the characters - _ . ! ~ * ' ( ) unchanged, and encodes everything else, including / ? # & = + : and @. Decoding uses decodeURIComponent, which turns every %XX sequence back into the original character.

Common Characters and Their Encodings

CharacterEncodedWhy it needs encoding
space%20Not allowed in a URL at all
&%26Separates one query parameter from the next
=%3DSeparates a parameter name from its value
?%3FMarks the start of the query string
#%23Starts the fragment; everything after it is not sent to the server
/%2FSeparates path segments
+%2BIn form-style query strings a plus sign means a space
%%25Starts every escape sequence
₹%E2%82%B9Non-ASCII; its three UTF-8 bytes are each encoded

Text in Indian scripts expands the same way. Each Devanagari character is three bytes, so the six characters of नमस्ते become 54 characters of %XX sequences.

Worked Example: Building a Search Link

Suppose a link should search for the text Pune & Mumbai. Pasting it straight into the query string as q=Pune & Mumbai breaks the link: the server sees q as just "Pune " and treats " Mumbai" as the name of a second, empty parameter.

Encoding only the value gives Pune%20%26%20Mumbai, so the query becomes q=Pune%20%26%20Mumbai. The space became %20 and the ampersand became %26, and the server now receives the full phrase as one value. In the same way, price=₹500? encodes to price%3D%E2%82%B9500%3F.

Practical Tips

  • Encode values, not whole addresses. Running a full address such as https://site.in/pay?amt=500 through the encoder gives https%3A%2F%2Fsite.in%2Fpay%3Famt%3D500, which no longer works as a link. That form is correct only when the entire address is itself a parameter value, for example a return or redirect address passed to a login or payment page.
  • Watch for double encoding. Encoding text that is already encoded turns each % into %25, so Pune%20Mumbai becomes Pune%2520Mumbai. If you see %25 followed by two hex digits, the value was encoded twice; decode it once more.
  • Plus signs are not converted. HTML forms send spaces as +, but decodeURIComponent leaves + unchanged. For form data, replace each + with a space before decoding.
  • Decode a long link before trusting it. Tracking and redirect links in emails or SMS messages often hide the real destination inside an encoded parameter. Decoding it shows where the link actually leads.

Frequently Asked Questions

URL encoding converts special characters (like spaces, &, ?, #) into a %XX format so they can be safely included in a URL query string or path segment without breaking the URL's structure.

This tool encodes/decodes a URL component — meaning it also escapes characters like & and = that are structurally meaningful in a full URL, so use it on individual parameter values, not an entire URL.

Decoding fails if the input contains an incomplete or invalid %XX escape sequence, since that can't be mapped back to a valid character.

This tool decodes with decodeURIComponent, which only converts %XX sequences. Data submitted from HTML forms uses + for spaces, so replace each + with a space first. A real plus sign in such data is sent as %2B and will decode correctly.

It is a double-encoded space. The first encoding turned the space into %20, and a second encoding turned that percent sign into %25. Decoding once gives %20 and decoding again gives the space. Fix the code that encodes the value twice rather than decoding twice on the receiving side.
No ratings yet — be the first!
Rate this calculator:

Related Calculators

Was this tool helpful?