Skip to main content

The encoding mistakes that break links

Double encoding is the big one: encoding an already-encoded string turns %20 into %2520, and the link breaks. If your URL has %25 in it, that's the tell: %25 is the encoding of the % sign itself, which means something got encoded twice. Decode once and try again.

The other classic: encoding a full URL instead of just the parts that need it. The ? that starts the query string and the & between parameters are structural: encode them and the server can't parse the URL anymore. Encode the values (the search term, the name, the message), leave the structure alone.

How to Use URL Encoder

  1. 1Choose Encode or Decode, then the mode: 'Component' for individual query parameter values, 'Full URL' for a complete URL.
  2. 2Paste or type your text or URL into the input area, or press 'Try a sample'. The result updates as you type.
  3. 3Tick 'Each line separately' to convert a list of values or URLs one line at a time.
  4. 4Click '⇄ Swap' to move the output back to the input and flip the direction, for checking a round trip.
  5. 5Copy the result, or download it as a text file.
  6. 6Encoding a full URL with query parameters? Encode only the parameter values, not the whole URL: encoding the ? and & breaks the structure.

Frequently Asked Questions

What is URL encoding?

URL encoding (percent-encoding) replaces characters that are not safe in URLs with a % followed by their hexadecimal ASCII code. For example, a space becomes %20 and & becomes %26. This ensures URLs remain valid when transmitted over the internet.

What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent encodes everything except A–Z, a–z, 0–9, -, _, ., !, ~, *, ', (, ). Use it for individual query parameter values. encodeURI leaves the structural characters of a URL intact (/, ?, &, =, #, :) and is used for encoding a complete URL while preserving its structure.

When should I use URL encoding?

Encode query parameter values when they contain special characters like spaces, ampersands, or equals signs. Encode file paths that contain non-ASCII characters. Encode the entire URL if it was constructed with user input that may contain spaces or international characters.

Why does decoding fail?

Decoding fails if the input contains an invalid percent-encoded sequence: for example, a lone % not followed by two hexadecimal digits, or bytes that don't make up valid UTF-8. The tool says so instead of showing a garbled result.

Why does a + turn into a space when I decode?

In Component mode, a + is read as a space, because that's how HTML forms send spaces in a query string (q=hello+world). A real plus sign is encoded as %2B, so it survives. Full URL mode leaves + alone, as it's a legal character in a path.

Why do I need to encode URLs at all?

Because URLs can only safely contain a limited set of characters. Spaces, accented letters, emoji, and symbols like # or ? have special meanings (or no meaning) in a URL. Encoding converts them to % followed by two hex digits (%20 for a space) so they travel safely and arrive intact.

What's the difference between encodeURI and encodeURIComponent?

encodeURI leaves structural characters (?, &, #, /) alone because they're part of the URL's syntax; encodeURIComponent encodes everything except the safest characters, which is what you want for a single value you're plugging into a query string. This tool does both: Component mode for a single value, Full URL mode for a whole address.

Does it remember what I typed?

Only if you leave "Remember recent inputs" ticked: it keeps the last five things you typed here in this browser, and nothing is sent anywhere. Pick one from the Recent menu to bring it back, or press "Clear recent" to forget them. Unticking the box stops it and wipes the list.

About URL Encoder

The URL Encoder and Decoder is a practical tool for web developers, QA engineers, and anyone working with URLs that contain special characters or non-ASCII text. Properly encoding URLs is essential for ensuring they work correctly in all browsers and HTTP clients, and for preventing security issues like query string injection.

The two modes cover the two most common URL encoding scenarios. Component mode (encodeURIComponent) is what you need when constructing query strings programmatically. It ensures that values containing characters like &, =, ?, and # are safely encoded so they don't interfere with URL structure. Full URL mode (encodeURI) is useful when you have a complete URL that needs to be encoded without breaking its structural characters.

URL decoding is equally important when working with incoming request parameters, reading URLs from logs, or debugging API calls. Percent-encoded URLs like https://example.com/search?q=hello%20world%20%26%20more are much easier to read and edit after decoding. The swap button lets you quickly decode an encoded URL, edit it, then re-encode for use.

Common use cases include: encoding user search queries before appending to a URL, decoding URLs copied from browser address bars or server logs, preparing URLs for use in HTML attributes or JavaScript fetch() calls, and debugging API requests that contain special characters in parameters.

You've seen them: URLs with %20 where the spaces should be, %C3%A9 where the é should be. That's percent-encoding, and it's what keeps URLs working when they contain anything beyond plain ASCII letters and numbers. This tool does the conversion in both directions: encode the messy string, decode the ugly one.

You May Also Like