Home / Developer / URL Encode & Decode

URL Encode & Decode

Percent-encode text for URLs, or decode %XX sequences back.

About this url encode & decode

URLs cannot contain spaces, ampersands and most non-English characters raw โ€” they must be percent-encoded (a space becomes %20). This tool encodes text so it is safe inside a link or query string, and decodes percent-encoded text back to readable form.

How to use it

  1. Paste your text or URL part.
  2. Encode to make it URL-safe, or decode to read it.
  3. Copy the result.

The formula

Each unsafe byte โ†’ %XX (its hexadecimal code): space = %20, & = %26, ? = %3F

Worked example

"fish & chips?" encodes to fish%20%26%20chips%3F.

Frequently asked questions

What is the difference between + and %20 for spaces?

In query strings from HTML forms, + can mean a space. encodeURIComponent (used here) produces %20, which is unambiguous and safest.

Should I encode a whole URL?

Encode the parts you add โ€” query values, search terms, filenames. Encoding a full URL would escape its :// and / structure too.

Which characters never need encoding?

Letters, digits and - _ . ! ~ * ' ( ) pass through encodeURIComponent unchanged.