URL Encoder/Decoder

Encode text so it is safe to put in a URL or query parameter, or decode a percent-encoded string back to readable text.

Encode URL

Decode URL

How to encode or decode a URL

  1. To encode, paste text into the Encode URL box and press Encode. The box content is replaced with the encoded result.
  2. To decode, paste a percent-encoded string into the Decode URL box and press Decode.
  3. Encode only the part that goes inside the URL, such as a query value or a path segment. Encoding the whole address also encodes its : and / characters, and the link stops working.
  4. Copy the result from the box.

Example: a query value with spaces and symbols

Say you need to pass kopi & teh?harga=Rp 25.000 as one query value. Encoding it gives:

kopi%20%26%20teh%3Fharga%3DRp%2025.000

Spaces become %20, & becomes %26, ? becomes %3F and = becomes %3D. Without encoding, the server would read & as the start of a new parameter and the value would stop at kopi.

Frequently asked questions

Why did the slashes and colon in my URL get encoded?

This tool uses encodeURIComponent, which encodes every character with a special meaning in URLs, including : / ? & and =. That's right for a single value. Encoding a full address like https://henggana.com/?q=jest mock gives https%3A%2F%2Fhenggana.com%2F%3Fq%3Djest%20mock, which no longer works as a link. Encode only the value: jest%20mock.

What is the difference between encodeURI and encodeURIComponent?

encodeURI is meant for a whole URL and leaves : / ? # & and = alone. encodeURIComponent is meant for one piece of a URL and encodes those characters too. In JavaScript code, use encodeURIComponent for query values, or URLSearchParams, which encodes them for you.

Why does Decode do nothing?

The input has a % that isn't followed by two hex digits, such as 100%. decodeURIComponent throws a URIError on that, and the tool leaves the text unchanged. Replace a literal % with %25 and decode again.

Why is + not turned into a space?

In HTML form data (application/x-www-form-urlencoded), + stands for a space, but decodeURIComponent only decodes percent sequences, so kopi+susu stays kopi+susu. Replace + with %20 before decoding.

Should spaces be %20 or +?

%20 works anywhere in a URL. + means a space only in query strings that use form encoding. If you're not sure, use %20.