Encode/decode URL-formatted strings

Encode text to URL-encoded format (also known as "percent-encoded"), or decode from it.

Enable JavaScript to use the interactive tool. The guide below explains how it works.

URL Encoder & Decoder: Mastering Percent-Encoding

In the early days of the web, URLs were designed to be simple and composed of a limited set of characters. As the internet evolved into a global platform supporting thousands of languages and complex data structures, a system was needed to represent non-standard characters within the strict confines of a URL. This system is known as Percent-Encoding, and the URL Encoder & Decoder is the essential tool for managing it.

1. What the Tool Does

The URL Encoder transforms "unsafe" characters into a format that can be safely transmitted over the internet. Conversely, the Decoder takes these encoded strings and returns them to their original, human-readable form.

The Mechanism of Percent-Encoding

When a character is encoded, it is replaced by a % followed by the two-digit hexadecimal representation of its ASCII (or UTF-8) value. For example:

The tool handles:

2. Why Someone Uses It

URLs have a specific "grammar." Certain characters are reserved for structural purposes (like / for paths, ? for queries, and # for fragments). If your data contains these characters, you must encode them to avoid confusing the browser or the server.

Passing Data in Query Parameters

If you want to send a search query like "Coffee & Tea" via a URL, you can't just write ?q=Coffee & Tea. The server would see the & and think it's the start of a new parameter. By encoding it to ?q=Coffee%20%26%20Tea, you ensure the server receives the literal string "Coffee & Tea".

Handling Multilingual Content

If your website supports international users, their names or locations might contain accented characters (like é or ü). These are not part of the standard ASCII set allowed in URLs. Encoding ensures that these characters are preserved correctly as they travel across the network.

Web Scraping and Automation

When writing scripts to interact with websites, you often have to construct URLs programmatically. If you don't encode your inputs, your scripts will likely fail as soon as they encounter a special character or a space.

3. Step-by-Step Instructions

  1. Select Your Mode: Choose whether you want to Encode or Decode.
  2. Input Your Text: Paste the text you want to process into the input area.
  3. Review the Output: The tool will provide the result in real-time.
  4. Special Options:
    • Encode All Characters: Usually, standard characters like a-z and 0-9 aren't encoded. Some use cases require encoding every single character for maximum safety or obfuscation.
    • Decode Mode: If you have a messy URL you found in a log file, paste it in "Decode" mode to see what the original values were.
  5. Copy and Use: Click the copy button to take the result and use it in your code, browser address bar, or documentation.

4. Examples

Basic Special Characters

Structural Conflict

Emojis and International Text

5. FAQs

What is the difference between encodeURI and encodeURIComponent?

In JavaScript programming:

Should I encode the whole URL?

No. If you encode the https:// part, it becomes https%3A%2F%2F, and your browser won't know how to open it. You should only encode the parts of the URL that contain user-generated data or special characters (usually the path or the query values).

Is URL encoding a form of encryption?

Absolutely not. URL encoding is a public, standard translation. Anyone with a decoder can see the original data. Never use URL encoding to "hide" sensitive information like passwords or private keys.

6. Common Mistakes

7. Use Cases

API Development

When building APIs, you frequently need to test how your server handles edge cases like extremely long strings, symbols, and non-English characters. This tool allows you to quickly generate these test strings.

SEO and Link Building

SEO specialists use URL encoders to ensure that their "slugs" (the descriptive part of the URL) are clean and won't be broken by social media platforms or email clients that might struggle with raw special characters.

Deep Linking in Mobile Apps

Mobile apps often use "custom schemes" (e.g., myapp://user/profile?name=John). Encoding the parameters in these deep links is vital for ensuring the app's router can correctly identify the destination.

8. Related Tools

All tools

Guides and articles