URL Encoder / Decoder

Encode and decode URL strings instantly. Component and full URL modes. Free, client-side, no signup required.

Your data never leaves your browser Available via MCP

How to Use

  1. Select Encode or Decode mode.
  2. Choose Component (for query params) or Full URL mode.
  3. Paste your text and click Go.
  4. Copy the result or use Swap to reverse.

Component vs. Full URL Encoding

encodeURIComponent encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ). Use this for individual values in query strings. For example, if a user's search term contains & or =, these must be encoded to avoid being interpreted as URL delimiters.

encodeURI preserves URL-structural characters like : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use this when encoding a complete URL where the structure should remain intact but non-ASCII characters (like spaces or accented letters) need to be percent-encoded.

What Is URL Encoding?

URL encoding (also called percent-encoding) is a mechanism for encoding characters in a Uniform Resource Identifier (URI) that are not allowed or have special meaning. The encoding replaces unsafe characters with a % followed by two hexadecimal digits representing the character's byte value. For example, a space becomes %20, an ampersand becomes %26, and the plus sign becomes %2B.

URLs can only contain a limited set of characters from the US-ASCII character set. Characters outside this set — including Unicode characters, spaces, and reserved characters used outside their intended purpose — must be percent-encoded to form a valid URL. This is defined by RFC 3986.

When to Use URL Encoding

  • Query string parameters — When passing user input, filenames, or arbitrary text as URL parameters: ?search=hello%20world
  • Form submissions — HTML forms with method="GET" automatically URL-encode field values in the query string
  • API requests — REST APIs often require URL-encoded parameters for search queries, filter values, and pagination tokens
  • Redirect URLs — When embedding a URL inside another URL (e.g., OAuth callback URLs), the inner URL must be fully encoded
  • Cookie values — Special characters in cookie values should be URL-encoded to avoid parsing issues
  • Internationalized URLs — Non-ASCII characters in URLs (e.g., Chinese, Arabic, or accented characters) must be UTF-8 encoded then percent-encoded

Common Mistakes with URL Encoding

Double encoding is the most frequent mistake. This happens when an already-encoded string is encoded again, turning %20 into %2520. Always check whether your framework or library automatically encodes parameters before manually encoding them.

Using the wrong function is another common error. Using encodeURI on a query parameter value will leave characters like & and = unencoded, breaking the query string structure. Conversely, using encodeURIComponent on a full URL will encode the :// and path separators, making the URL invalid.

Forgetting to decode on the server side leads to displaying encoded values like John%20Doe to users. Most server frameworks decode automatically, but when building URLs manually or parsing query strings, remember to decode with decodeURIComponent.

URL Encoding in Different Languages

JavaScript provides encodeURIComponent() and decodeURIComponent() for component encoding. Python uses urllib.parse.quote() and urllib.parse.unquote(). In PHP, urlencode() and rawurlencode() serve similar purposes (the difference being how spaces are handled — + vs %20). Java uses URLEncoder.encode() with a specified charset.

Related Tools

After encoding URL parameters, Base64-encode payloads for APIs that expect Base64 input. Verify JSON structure with the JSON Validator. Generate URL-safe identifiers with the UUID Generator. Encode HTML special characters with the HTML Entity Encoder. Create QR codes from URLs with the QR Code Generator. Test URL patterns with the Regex Tester. Generate SEO-friendly URL slugs with the Slug Generator. Escape strings for different contexts with the String Escape Tool.

Frequently Asked Questions

What is URL encoding?
URL encoding (also called percent-encoding) replaces unsafe or reserved characters in a URL with a % followed by two hexadecimal digits. For example, a space becomes %20. This ensures URLs are transmitted correctly across the internet.
What is the difference between Component and Full URL mode?
Component mode (encodeURIComponent) encodes all special characters including /, ?, &, and =. Use it for encoding individual query parameters or path segments. Full URL mode (encodeURI) preserves URL structure characters, encoding only characters that are invalid in any part of a URL.
When should I use URL encoding?
Use URL encoding when including user input in query strings, encoding special characters in API parameters, or building URLs programmatically. It prevents characters like &, =, and spaces from breaking URL structure.
Is my data safe?
Yes. All encoding and decoding uses built-in browser functions (encodeURIComponent/decodeURIComponent). Nothing leaves your browser.

Code Examples

Learn how to use this tool programmatically in your favorite language.

Use this tool from AI agents. The CodeTidy MCP Server lets Claude, Cursor, and other AI agents use this tool and 46 others directly. One command: npx @codetidy/mcp

Drop file to load