Skip to content
Tools

URL encoder & decoder

Encode and decode text with encodeURIComponent or encodeURI.

encodeURIComponent

About URL encoding

Component
Encodes every reserved character, including / ? & =. Use it for query parameter values.
Full URL
Keeps the characters that give a URL its structure (/ ? # &). Use it for complete URLs.

About the URL encoder & decoder

This URL encoder percent-encodes text so it can be placed safely in a URL, and decodes percent-encoded text back to readable form. Use it when building query strings by hand, debugging a redirect URL, or reading an encoded link from a log.

How to use it

  1. Choose a mode: Component (encodeURIComponent) or Full URL (encodeURI).
  2. Type or paste text into the Text box and click Encode, or paste encoded text into the Encoded box and click Decode.
  3. Use the copy button above either box to copy the result.
  4. Click Load sample to try an example, or Reset to clear both boxes.

Which mode to use

Component encodes reserved characters such as / ? & = and #, so use it for a single query parameter value or path segment. Full URL leaves those characters alone so a complete URL keeps its structure.

Example

In Component mode, a=1&b=2 becomes a%3D1%26b%3D2. In Full URL mode the same text is unchanged, because = and & are kept.

Privacy

Encoding uses your browser's built-in JavaScript functions. Nothing you enter is sent to a server.

Questions

What is the difference between encodeURI and encodeURIComponent?
encodeURI is meant for a whole URL and does not encode characters like : / ? # & =. encodeURIComponent encodes all of them, which is what you want for a value inside a URL.
Should a space be encoded as %20 or +?
Both functions encode a space as %20, which works anywhere in a URL. The + form comes from HTML form encoding and is only treated as a space in query strings, and this tool decodes + as a literal plus sign.
Why do I get an error when decoding?
Decoding fails when a % is not followed by two hex digits, or when the percent-encoded bytes are not valid UTF-8. A literal % in the original text should have been encoded as %25.