URL Encode and Decode

Encode or decode a URL component.

What this URL encoder and decoder does

URLs can only contain a limited set of characters. Spaces, accented letters and symbols such as &, ? or # have to be converted to percent-encoded form before they can safely appear inside a URL. This tool encodes text for use in a URL, and decodes percent-encoded text back to readable form. It uses JavaScript's standard encodeURIComponent and decodeURIComponent functions and runs in your browser.

It is for web developers building links and API requests, marketers creating tracking URLs, SEO specialists reading encoded URLs in reports, and support teams decoding links from logs.

How to use the URL encoder

  1. Paste your text into the Text box.
  2. Click Encode to convert it to percent-encoded form. Spaces become %20.
  3. Or click Decode to convert percent-encoded text back to normal characters.
  4. Copy the result with the Copy button.

If decoding fails, the text contains an incomplete or invalid percent sequence, such as a lone % that is not followed by two hexadecimal digits.

How percent-encoding works

Percent-encoding is defined in RFC 3986, the URI standard. A character that is not allowed in a given part of a URL is replaced by a percent sign followed by two hexadecimal digits for each byte of its UTF-8 representation. For example:

  • Space → %20
  • & → %26
  • = → %3D
  • / → %2F
  • é → %C3%A9 (two bytes in UTF-8)

Example

Encoding "price=10 & 20% off/café" gives "price%3D10%20%26%2020%25%20off%2Fcaf%C3%A9". Decoding that string returns the original text.

This tool encodes a URL component, such as a single query-parameter value or path segment. Letters, digits and the characters - _ . ! ~ * ' ( ) are left as they are; everything else, including /, ?, &, = and #, is encoded.

Common use cases

  • Putting a search phrase, email address or another URL into a query parameter, for example ?redirect= or ?q=.
  • Building UTM campaign links whose values contain spaces or symbols.
  • Reading encoded URLs from analytics, server logs or redirect chains.
  • Preparing parameters for API calls in tools such as curl.
  • Fixing links that break because they contain spaces or non-English characters.

Tips and common mistakes

  • Encode values, not whole URLs. Because this tool encodes :, / and ?, encoding a full address such as https://example.com/a?b=c turns it into one long encoded string. That is correct when the whole URL is a parameter value inside another URL, but wrong if you want a working link. Encode each parameter value separately and join them with unencoded ?, & and =.
  • Don't encode twice. Encoding an already encoded string turns %20 into %2520. If you see %25 in a URL, it was probably double-encoded.
  • Plus signs and spaces. In HTML form submissions (application/x-www-form-urlencoded), a space is often written as +. This tool encodes spaces as %20 and does not turn + back into a space when decoding. Replace + with %20 first if your text came from a form.
  • Use UTF-8. Modern browsers and servers expect UTF-8 for percent-encoded text, which is what this tool uses.
  • Encoding is not security. URL encoding makes text safe to transport, but it does not hide it or protect against attacks. Always validate input on the server.

Frequently asked questions

What is URL encoding?

URL encoding, or percent-encoding, replaces characters that are not allowed in a URL with a % sign and two hexadecimal digits per byte, so the URL can be transmitted reliably.

Why does a space become %20?

The space character has the code 32, which is 20 in hexadecimal. Spaces are not allowed in URLs, so they are encoded as %20.

What is the difference between %20 and +?

%20 is the standard percent-encoding of a space. + represents a space only in form-encoded query strings. Use %20 when in doubt.

What is the difference between encodeURI and encodeURIComponent?

encodeURI keeps characters that structure a URL, such as /, ? and &. encodeURIComponent, used here, encodes them too, which is what you need for individual parameter values.

Why do I get an error when decoding?

The text probably contains a % sign that is not part of a valid escape sequence, or an incomplete multi-byte sequence.

Is my text sent to a server?

No. Encoding and decoding happen in your browser.

Related tools

  • URL Slug Generator – turn a title into a clean, lowercase URL slug.
  • HTML Encode / Decode – convert special characters to HTML entities.
  • Base64 Encode / Decode – encode text as Base64.
  • Short URL – shorten long links.
  • QR Code Generator – turn an encoded link into a QR code.