URL Encoder / Decoder

Safely encode URI components or decode gibberish URLs into readable strings.

URL Encoder

How to Use

1

Input Text or URL

Paste the string or complete URL parameters you want to process.

2

Select Mode

Choose Encode to secure characters, or Decode to convert percent-escaped text back to readable text.

3

Process & Copy

Click the button and copy the resulting string for immediate API or browser usage.

Why Encode URLs?

URLs can only be sent over the Internet using the ASCII character-set. Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid format. URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits.

Real-World Examples & Use Cases

API & Query Parameter Construction

When sending data via HTTP GET requests, dynamic parameters (such as query strings) must be safe. A search query containing spaces or special symbols like `&` and `=` will break standard URL parsing. URL encoding converts these characters (e.g., space → `%20`, `&` → `%26`) so they are transmitted accurately to the server.

Handling Non-ASCII Characters in URLs

Domains and page routes frequently include international or accented characters (like `é` or `ü`). Because URLs only support standard ASCII characters, these non-ASCII code points must be URL-encoded before browser transmission to prevent 404 page routing errors.

Decoding Webhook & Callback Payloads

OAuth callback sequences, payment webhook events, and tracker redirects often transmit their payload responses inside URL-encoded parameters. Developers must decode these strings to inspect JSON structures or authentication codes during debugging.

How It Works

URL Encoding (Percent-Encoding) Mechanism: According to RFC 3986, characters are divided into reserved and unreserved categories. Unreserved characters (letters, numbers, and `-`, `.`, `_`, `~`) are never encoded. Reserved characters (such as `:`, `/`, `?`, `#`, `[`, `]`, `@`, `!`, `$`, `&`, `'`, `(`, `)`, `*`, `+`, `,`, `;`, `=`) have special meaning in URL structures and must be encoded when used as data. The encoding process is as follows: 1. Convert the character to its UTF-8 byte sequence. 2. Format each byte as a percent character (%) followed by two uppercase hexadecimal digits. For example, the space character (ASCII 32) in hex is `20`, so it becomes `%20`. The ampersand character (`&`) in hex is `26`, converting to `%26` to avoid conflicts with URL parameter separators. In JavaScript: - `encodeURI` leaves domain delimiters (like `:` and `/`) intact, making it ideal for complete URLs. - `encodeURIComponent` encodes every reserved character, making it ideal for single query values.

Frequently Asked Questions

Why does URL encoding turn spaces into %20 or +?
Under the standard RFC 3986 (URI Generic Syntax), space is encoded as `%20`. However, when encoding application/x-www-form-urlencoded query strings (often used in HTML form submissions), spaces are historically represented by a plus sign (`+`). Both formats are widely accepted, but `%20` is the standard for generic URLs.
What is the difference between encodeURI and encodeURIComponent?
`encodeURI` is intended for encoding a complete, working URL. It does not encode characters that have structural meaning in a URL (like `http://`, `/`, `?`, `&`, `=`). `encodeURIComponent` is meant for encoding a single query parameter value. It encodes *all* special characters, including slashes and query signs, to ensure the value doesn't break the container URL structure.
What characters are considered safe and never encoded?
Characters that are never encoded are called "unreserved characters". This includes all uppercase and lowercase English letters (A-Z, a-z), decimal digits (0-9), and the four symbols: hyphen (`-`), period (`.`), underscore (`_`), and tilde (`~`).
Is URL encoding a form of encryption?
No. URL encoding is a simple representation translation, not encryption. It is fully reversible and does not use any keys or secure algorithms. Its sole purpose is data serialization to ensure safe passage through network protocols and browser address bars.

Related Tools

Explore other tools in this category.

Looking for something else?