# URL encoder and decoder

URL: https://shahid09.is-a.dev/tools/url-encoder-decoder/
Author: Muhammad Shahid (https://shahid09.is-a.dev/)
Free tool · runs in your browser

Encode text so it is safe in a URL, decode percent-encoded text back to normal, and list the parameters in a query string.

**Quick answer:** URLs can only contain certain characters, so others are written as percent-encoding: a space becomes %20, & becomes %26 and é becomes %C3%A9 (its UTF-8 bytes). Use Encode for a single value such as a search term or parameter, which encodes everything that has a special meaning, or tick Whole URL to keep : / ? & = as they are. Decode turns it back into readable text.

## How to use it

1. **Choose Encode or Decode.** Encode makes text safe for a URL; Decode turns %-codes back into text.
2. **Paste your text or URL.** A parameter value, a full link or an encoded string from a log.
3. **Copy the result.** If the input is a link, its query parameters are listed too.

## Example

A query string encoded as a single value:

Input:

```
name=Sara Levi&city=Tel Aviv
```

Output:

```
name%3DSara%20Levi%26city%3DTel%20Aviv
```

## Common errors and how to fix them

- **URIError: URI malformed**: There is a % not followed by two hex digits, or the codes are not valid UTF-8. Encode a literal % as %25.
- **Spaces show as + after decoding**: Form data writes spaces as +. Tick "Treat + as a space", or use URLSearchParams, which handles it.
- **The link shows %2520**: The value was encoded twice. Encode each value once, just before you add it to the URL.
- **Parameters after & go missing**: The value contained an unencoded & or #. Encode each value with encodeURIComponent, not the whole URL with encodeURI.

## Frequently asked questions

### What is URL encoding?

Writing characters that are not allowed or have a special meaning in URLs as % followed by two hexadecimal digits, for example a space as %20.

### What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent encodes everything with a special meaning, including / ? & and =, for use in one value. encodeURI keeps those characters so a whole URL still works. This tool uses encodeURIComponent unless you tick Whole URL.

### Should a space be %20 or +?

In paths, a space is %20. In form data and many query strings, + also means a space. Tick "Treat + as a space" when decoding form data.

### Why is my link cut off at & or #?

Those characters end a parameter or start a fragment. Encode each value with encodeURIComponent so & becomes %26 and # becomes %23.

### What does %2520 mean?

The text was encoded twice: %20 was encoded again into %2520. Decode once more, and fix the code that encodes twice.

### How are non-English characters encoded?

They are converted to UTF-8 bytes, and each byte is written as %XX. For example, é becomes %C3%A9.

### How do I encode a URL in JavaScript?

encodeURIComponent(value) for one parameter, or new URLSearchParams({ q: value }).toString() to build a query string.

### How do I encode a URL in Python?

urllib.parse.quote(value) for a path part, or urllib.parse.urlencode({"q": value}) for a query string.

### Is URL encoding the same as Base64?

No. Percent-encoding only replaces unsafe characters; Base64 rewrites all the data with 64 characters.

### Is my data sent anywhere?

No. Encoding and decoding run in your browser.

## Related

- [Base64 encoder and decoder](https://shahid09.is-a.dev/tools/base64-encoder-decoder/)
- [WhatsApp link generator](https://shahid09.is-a.dev/tools/whatsapp-link-generator/)
- [JSON formatter and validator](https://shahid09.is-a.dev/tools/json-formatter/)
