URL Encoder / Decoder

Encode and decode URLs instantly. Convert special characters to URL-safe format for web development, API integration, and debugging.

Text to Encode

Result

About URL Encoding

URL encoding (percent-encoding) is used to encode special characters in URLs. Reserved characters like spaces, ":", "/", "?", "#", and "[" are replaced with a percent sign (%) followed by two hexadecimal digits. This ensures URLs are transmitted correctly over the internet.

URL encoding (also called percent-encoding) converts characters into a format that can be transmitted over the Internet. URLs can only contain a limited set of characters (ASCII letters, digits, and special symbols - _ . ~). All other characters must be encoded. This tool makes it easy to encode URLs for web development, decode URLs from logs or API responses, and understand how URLs handle international characters and special symbols.

Category: Developer Tools

When to Use This Tool

  • Building URLs with query parameters containing special characters
  • Decoding URL-encoded data from web forms or API responses
  • Handling international domain names (IDN) in URLs
  • Debugging why a URL isn't working or loading correctly
  • Creating shareable links with special characters in titles
  • Processing URLs extracted from web scraping or data analysis
  • Working with redirect URLs that contain encoded parameters

How to Use

Encode a URL or Text

  1. Paste your URL or text in the input field
  2. Click 'Encode' to convert special characters
  3. Special characters will be replaced with %XX format
  4. Copy the encoded URL for use in your project

Decode an Encoded URL

  1. Paste an encoded URL in the input field
  2. Click 'Decode' to reveal the original text
  3. Verify the decoded result is correct
  4. Commonly needed when debugging API responses or redirects

Understanding URL Encoding

  1. Spaces become %20 or + (query strings)
  2. Letters, numbers, and -_.~ are never encoded (RFC 3986)
  3. Chinese/Japanese characters become multiple %XX bytes (UTF-8)
  4. Query string ? and & separate parameters
  5. Use encodeURIComponent() for values, encodeURI() for full URLs

Examples

Query Parameter Encoding

Used in URL query strings - note how = and & are encoded

Input

name=John Doe&city=New York

Result

name%3DJohn%20Doe%26city%3DNew%20York

Search Query Encoding

Spaces become %20, question mark becomes %3F

Input

How to learn Python?

Result

How%20to%20learn%20Python%3F

Chinese Characters (UTF-8)

Each Chinese character becomes 3 bytes in UTF-8

Input

搜索=关键词

Result

%E6%90%9C%E7%B4%A2%3D%E5%85%B3%E9%94%AE%E8%AF%8D

Full URL Encoding

In practice, use encodeURI() for full URLs (doesn't encode :// etc.)

Input

https://example.com/path?search=hello world

Result

https%3A%2F%2Fexample.com%2Fpath%3Fsearch%3Dhello%20world

Frequently Asked Questions

What's the difference between encodeURI() and encodeURIComponent()?

encodeURI() encodes characters that are legal in URLs but not in query strings (like #, ?, &, =, /). It doesn't encode :// . ? #. encodeURIComponent() encodes EVERYTHING except alphanumeric characters. Use encodeURIComponent() for parameter VALUES, encodeURI() for full URLs.

Why do URLs have %20 everywhere?

%20 is the URL-encoded space character. URLs can't contain literal spaces, so they must be encoded. Some old systems used + for spaces in query strings, but %20 is the modern standard (RFC 3986).

What happens to special characters like emoji?

Emoji and other 4-byte Unicode characters are encoded as multiple %XX sequences. For example, 😀 (U+1F600) becomes %F0%9F%98%80 in UTF-8. Some older systems don't handle this well and may show garbled text.

Is URL encoding the same as HTML encoding?

No! HTML encoding uses &lt; for < and &gt; for >. URL encoding uses %20 and %3C. They serve different purposes - HTML for displaying in web pages, URLs for transmitting in web addresses.

What characters should always be encoded?

Any character outside ASCII (128 characters) should be encoded in URLs. This includes: spaces, Chinese/Japanese/Korean text, emoji, accented letters (é, ñ, etc.), and special symbols (!@#$%^&*). Even ASCII characters like spaces and & should be encoded when in query parameter values.

Pro Tips

  • Always use encodeURIComponent() for individual query parameter values, not encodeURI()
  • Don't double-encode! If a value is already encoded, decoding first then encoding again ensures consistency
  • URLs in browser address bar are usually displayed decoded for readability but transmitted encoded
  • Backend frameworks often decode URLs automatically - check your framework's documentation
  • For international domain names, the browser automatically handles Punycode conversion
  • Base64 in URLs should use URL-safe Base64 (- and _ instead of + and /)
  • Query string parameters should be individually encoded, not the whole URL with encodeURI()

Related Tools