URL Encoder / Decoder

Encode and decode URLs (percent-encoding) instantly. Supports full URLs and individual components. All processing happens in your browser.

0 characters

What is URL Encoding?

URL encoding, also known as percent-encoding, is a mechanism defined in RFC 3986 for representing characters in a Uniform Resource Identifier (URI) that may not be safe for direct use. Unsafe characters are replaced with a % followed by two hexadecimal digits representing the character's byte value.

For example, a space becomes %20, the ampersand & becomes %26, and Cyrillic or Chinese characters are first converted to UTF-8 bytes and then percent-encoded. Without URL encoding, browsers and servers may misinterpret special characters, breaking links and API requests.

encodeURIComponent vs encodeURI

JavaScript provides two built-in functions for URL encoding. Choosing the right one is critical:

  • encodeURIComponent — encodes all special characters including : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use this when encoding individual values, such as a search query or a single parameter value. This is the most commonly used function.
  • encodeURI — preserves characters that form the structure of a complete URI (: / ? # [ ] @). Use this when encoding an entire URL while keeping its structure (protocol, path, query separators) intact.

Common Encoded Characters

  • Space → %20 (or + in form data)
  • &%26
  • =%3D
  • ?%3F
  • /%2F
  • #%23
  • @%40

When URL Encoding is Needed

  • Query parameters — any user input in URL parameters must be encoded to prevent injection and broken links
  • API requests — REST API calls often need encoded parameters, especially for filters, search terms, and pagination
  • Redirect URLs — callback URLs passed as parameters must be double-encoded to survive multiple processing stages
  • Internationalized URLs — non-ASCII characters (Cyrillic, Arabic, Chinese, etc.) require percent-encoding
  • Form submissions — HTML forms with GET method automatically URL-encode values, but manual encoding is needed for AJAX calls

Frequently Asked Questions

What is the difference between %20 and + for spaces?
Both represent a space, but in different contexts. %20 is the standard percent-encoding defined in RFC 3986. The + symbol is used specifically in HTML form data (application/x-www-form-urlencoded). In modern practice, %20 is preferred for URL paths, while + is common in query strings of form submissions.
When should I use encodeURIComponent vs encodeURI?
Use encodeURIComponent for individual values — a search query, parameter value, or any fragment that will be placed inside a URL. Use encodeURI only when you have a complete URL and want to encode unsafe characters while preserving its structure (protocol, host, path).
Are my data sent to the server?
No. All encoding and decoding is performed in your browser using standard JavaScript functions. Nothing is transmitted to our servers.