Encoding tool

URL Encoder / Decoder

Encode or decode URL text with encodeURI or encodeURIComponent behavior in your browser.

Your data is processed locally in your browser and is not sent to our server.

Result

Your result will appear here.

How to use URL Encoder / Decoder

  1. Choose URI or component mode.
  2. Paste text and select Encode or Decode.

Example

https://example.com/search?q=hello world&lang=en

Common use cases

  • Building a search link where the search term contains spaces, ampersands, or non-English characters.
  • Escaping a file name or path segment before placing it in a URL, so that a slash or question mark in the name does not change the route.
  • Decoding a percent-encoded redirect parameter or a log entry to read the original destination URL.

Input and output examples

InputOutputNotes
https://example.com/search?q=hello world&lang=enhttps://example.com/search?q=hello%20world&lang=enFull URI mode. The ?, &, and = stay as they are.
hello world & friendshello%20world%20%26%20friendsComponent mode. The & becomes %26, so it is safe inside a query value.

Common mistakes to avoid

  • encodeURI does not protect a value. encodeURI("a&b=c d") returns a&b=c%20d, so the & and = still split the query. Encode each value with the component mode.
  • encodeURIComponent encodes everything, including / : and ?. Passing a whole URL through it turns https:// into https%3A%2F%2F, which is broken as an address.
  • Plus signs are literal here. encodeURIComponent("a+b") returns a%2Bb, and decoding a+b keeps the plus. Check whether the receiving server expects + to mean a space.

Technical details

encodeURI and encodeURIComponent are JavaScript functions that percent-encode text as UTF-8 bytes, following the syntax of RFC 3986. encodeURI leaves reserved characters such as ? & = # / : unchanged, so it suits a complete URI. encodeURIComponent also encodes those characters, so it suits one query value or path segment. Decoding uses decodeURIComponent and rejects malformed sequences such as a lone %.

Frequently asked questions

When should I use encodeURIComponent?

Use it for individual query parameter values or path segments, not for an entire URL, because it also encodes / ? and =.

Why does a space become %20 and not +?

%20 is the percent-encoding of a space under RFC 3986. A plus sign means a space only in form data (application/x-www-form-urlencoded). This tool keeps + as a plus sign when decoding.

Why does decoding fail on a percent sign?

A % must be followed by two hexadecimal digits. A raw value such as 100% is malformed, so encode the percent sign as %25.

Does encodeURI encode non-English characters?

Yes. Each character is converted to its UTF-8 bytes, so 안녕 becomes %EC%95%88%EB%85%95.

Is my URL sent to a server?

No. Encoding and decoding run in your browser, and the tool code does not send the text to a server.

Why does encodeURI keep my & sign?

encodeURI treats & as a separator of a full URI, so it leaves it unchanged. If the & is part of a value, encode that value with the component mode.