# URL Encode/Decode

> The URL Encoder & Decoder percent-encodes or decodes text using either component mode (encodeURIComponent) or full-URI mode (encodeURI), and parses any URL into a table of its parts and query parameters.

URL: https://atechcraft.com/url-encoder-decoder/
Category: Developer Tools
Last updated: 2026-12-01
Author: Abdul Moid Khan, ATechCraft

Runs in your browser. Your data never leaves your device.

## How to use the URL Encode/Decode

1. Paste text or a URL.
2. Choose Component or Full URI mode, then Encode or Decode.
3. Look at the parsed table to see each query parameter decoded.
4. Copy the result.

## What is URL encoding?

URL encoding, also called percent-encoding, replaces characters that aren't allowed or have a special meaning in a web address with a `%` sign followed by two hexadecimal digits. A space becomes `%20`, `&` becomes `%26`, and the Urdu letter "ا" becomes `%D8%A7`. This tool encodes and decodes text in two modes (component and full URI) and breaks any URL into a table of its parts and query parameters.

You need URL encoding whenever you put user text, search terms or another URL inside a link.

## How does percent-encoding work?

The rules come from [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986), the standard for URIs:

1. Characters A–Z, a–z, 0–9 and `- . _ ~` are "unreserved" and never need encoding.
2. Characters like `: / ? # [ ] @ ! $ & ' ( ) * + , ; =` are "reserved": they structure the URL, so they must be encoded when they are part of the data.
3. Every other character, including spaces and all non-English letters, is converted to its **UTF-8 bytes**, and each byte is written as `%XX`.

For example, the euro sign € is three UTF-8 bytes (E2, 82, AC), so it becomes `%E2%82%AC`.

## Component or full URI: which mode do I need?

JavaScript has two built-in functions, and this tool lets you pick:

| Mode | Function | Leaves alone | Use it for |
| --- | --- | --- | --- |
| Component | `encodeURIComponent` | Letters, digits, `- _ . ! ~ * ' ( )` | A single value inside a URL, like a search term or a redirect URL |
| Full URI | `encodeURI` | All of the above plus `; , / ? : @ & = + $ #` | A whole URL that already has the right structure |

If you use full-URI mode on a value that contains `&`, the `&` stays as it is and splits your query string in two. That's the most common encoding bug.

## Worked example

You want to link to a search page with the query `chai & samosa`:

- **Component** encoding of `chai & samosa` gives `chai%20%26%20samosa`.
- The final link is `https://example.com/search?q=chai%20%26%20samosa`.

If you had used full-URI encoding instead, you'd get `chai%20&%20samosa`, and the server would read `q=chai ` plus a second, broken parameter named ` samosa`.

Now paste the finished link and switch to **Decode**. The URL parts table shows:

| Part | Value |
| --- | --- |
| Protocol | https: |
| Host | example.com |
| Path | /search |
| ?q | chai & samosa |

## Why is a space sometimes + and sometimes %20?

HTML forms submitted with GET use the older `application/x-www-form-urlencoded` format, where a space is written as `+`. Everywhere else in a URL, a space is `%20`. When decoding, tick **Treat + as space** for query strings from forms; untick it if the `+` is a real plus sign, as in a phone number like `+92`.

## Tips

1. **Encode each value separately,** then join them with `&`. Don't encode the whole query string at once.
2. **Building campaign links?** The [UTM Link Builder](https://atechcraft.com/utm-builder/) handles the encoding for you.
3. **Need binary-safe text instead?** Use the [Base64 tool](https://atechcraft.com/base64-encoder-decoder/), for example for data inside a JWT or a data URI.
4. **Readable URLs first:** create clean slugs with the [Slug Generator](https://atechcraft.com/slug-generator/) so there's less to encode.
5. **Writing redirect rules?** Check encoded paths before adding them with the [.htaccess Redirect Generator](https://atechcraft.com/htaccess-redirect-generator/).

## Limitations

- Decoding fails on a malformed sequence such as a lone `%` or `%G1`. The tool shows an error instead of guessing.
- `encodeURIComponent` doesn't encode `! ' ( ) *`, which RFC 3986 lists as reserved. Almost all servers accept them, but a few strict systems may not.
- The parser only shows parts for complete URLs starting with a scheme like `https://`.
- Internationalised domain names (like `پاکستان.pk`) are converted by browsers to "punycode" (`xn--…`), which is a different system from percent-encoding.

## Frequently asked questions

### When should I use component mode?

For a single value placed inside a URL, such as a search term in ?q=. It encodes characters like &, = and / that would otherwise break the URL.

### When should I use full URI mode?

For a whole URL that already has its structure. It keeps : / ? & = and # but encodes spaces and non-ASCII characters.

### Why is a space sometimes + and sometimes %20?

In HTML form data (application/x-www-form-urlencoded) spaces become +. In other parts of a URL they are %20. The decoder can treat + as a space.

### How are Urdu or emoji characters encoded?

They are converted to UTF-8 bytes, and each byte is written as %XX, as RFC 3986 requires.
