DFK Studio

Encode and decode URLs

Percent-encode a URL or a single value and decode it back, with the encodeURI and encodeURIComponent distinction made explicit.

  • Free, no account
  • Nothing is uploaded
  • Runs in your browser

How it works

  1. 1 What goes in A URL or a fragment of one
  2. 2 It runs in your browser On your own device. Nothing is uploaded, there is no queue and no account, and it keeps working with the network switched off.
  3. 3 What comes back It, encoded or decoded

What it does

Encode a whole URL or a single query value, and decode either back. The choice between the two is a control here rather than a guess, because using the wrong one is how a query string quietly breaks.

This page does the work itself. Your text is handled by the browser and never sent anywhere — there is no server here to send it to.

Questions

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent escapes the characters that separate the parts of a URL — / ? & = # — so a value is safe to drop inside a query string. encodeURI leaves them alone so a complete URL stays usable. Run the first over a whole URL and you get an unusable string; run the second over a value containing an ampersand and you have silently added a query parameter.

Why do some encoders turn spaces into + and others into %20?

Both are correct in their place. + means a space only in application/x-www-form-urlencoded — form submissions and query strings. In a path segment a + is a literal plus. The Scope selector picks which convention applies, so decoding does not corrupt a URL that legitimately contains one.

Why does decoding fail with a stray %?

Percent-encoding requires every % to be followed by two hex digits, so a literal percent sign has to be written %25. Text with a bare % in it is not valid encoding and decoders reject it rather than guess.

Every shelf