Developer

URL Encoder/Decoder

Spaces, symbols, and special characters break URLs — percent-encoding fixes that. Free to use, no sign-up.

Did this calculator help you?

What is URL Encoder/Decoder?

A URL Encoder/Decoder is an essential web development tool that converts between regular text and URL-safe percent-encoded format. When URLs contain spaces, special symbols, or non-ASCII characters like accented letters and emoji, they break unless properly encoded. This tool provides instant encoding and decoding with full support for both URL mode (encoding entire URLs) and component mode (encoding individual query parameter values), plus a batch mode for processing multiple strings at once. It handles all standard percent-encoding operations defined in RFC 3986, converting unsafe characters to their %XX hexadecimal representation and vice versa. Essential for web developers, API integrators, SEO specialists, and anyone working with query strings, redirects, or URL-based data transfer. The tool operates entirely in the browser with no server calls, making it fast and private.

When to Use This Calculator

  • You're building a URL with query parameters that contain spaces, symbols, or non-ASCII characters
  • You need to decode a percent-encoded URL to read its actual content
  • You're debugging an API that's rejecting your URL because of unencoded special characters
  • You're processing user-submitted URLs that need to be sanitized before use
  • You need to batch-encode or decode multiple URL segments at once
  • You're constructing redirects or callback URLs where parameters must be properly encoded

Steps:

  1. Type or paste the text/URL you want to encode or decode.
  2. Select Encode or Decode mode.
  3. Click the Convert button.
  4. Copy the result to use in your application.

Formula

Encoding: Unsafe chars → % + 2-digit hex code ➡ Decoding: %XX → Original character

Use Cases

  • Building safe query strings for URLs
  • Processing API request parameters
  • Debugging encoded URLs
  • Creating URL-friendly slugs and paths

Key Benefits

  • Instant encoding and decoding with real-time results as you type
  • Supports both URL mode and component mode for different encoding contexts
  • Batch mode for encoding or decoding multiple strings simultaneously
  • Handles all special characters including Unicode, emoji, and accented letters
  • 100% browser-based processing — no data sent to any server, completely private
  • Visual character count to verify encoding did not duplicate or truncate input

Pro Tips

  • Always encode user-generated URL parameters before including them in a URL to prevent injection attacks and broken links
  • Use encodeURIComponent() in JavaScript for individual query parameter values — it encodes more characters than encodeURI() which is designed for full URLs
  • Decode URLs before displaying them to users for better readability and trust — raw percent-encoded URLs look unprofessional and confuse non-technical users
  • Watch for double-encoding: if you see %25 followed by more hex digits, the URL was likely encoded twice
  • Use component mode when building query strings and URL mode when encoding entire URL paths or full URLs

Common Mistakes to Avoid

  • Double-encoding URLs by encoding a URL that is already percent-encoded, turning %20 into %2520
  • Using the wrong encoding context — URL mode vs component mode produce different output for the same input
  • Forgetting that the + sign only represents a space in application/x-www-form-urlencoded data, not in URL path segments where %20 is required
  • Not handling non-ASCII characters properly — always ensure UTF-8 encoding before percent-encoding

Key Terms Explained

Percent-Encoding: The standard mechanism for encoding characters in URLs, replacing unsafe characters with % followed by their two-digit hexadecimal ASCII code
Query String: The portion of a URL after the ? character, containing key-value pairs separated by & — must be properly encoded for safe transmission
Reserved Characters: Characters like :, /, ?, #, [, ], @, !, $, &, (, ), *, +, ,, ;, = that have special syntactic meaning in URLs per RFC 3986
Component Mode vs URL Mode: Component mode encodes more characters and is for individual values; URL mode preserves URL structure characters and is for full paths

Related Concepts

  • Percent-Encoding: The mechanism of replacing unsafe characters with % followed by their two-digit hexadecimal ASCII code for safe URL transmission
  • Query String: The portion of a URL after the ? character, containing key-value pairs separated by & characters
  • Reserved Characters: Characters like :, /, ?, #, [, ], @, !, $, &, (, ), *, +, ,, ;, = that have special meaning in URL syntax per RFC 3986
  • URL-safe Characters: Unreserved characters (letters, digits, -, _, ., ~) that do not require encoding in URLs
  • encodeURIComponent vs. encodeURI: JavaScript functions where encodeURIComponent encodes everything except letters, digits, and _*-.~ for individual values, while encodeURI preserves URL structure characters for full URLs

Example

Encoding "Hello World & Friends!" → "Hello%20World%20%26%20Friends%21". Decoding "search%3Fq%3Dhello+world" → "search?q=hello world".

Interpreting Your Results

The encoder converts unsafe URL characters (spaces, &, ?, #, non-ASCII, etc.) into percent-encoded format where each character becomes % followed by its two-digit hexadecimal code. The decoder reverses this process, restoring the original readable text. The character count helps you verify that encoding didn't unexpectedly duplicate or truncate your input. Component mode encodes a broader set of characters and is designed for encoding individual query parameter values. URL mode is stricter about what gets encoded and is designed for encoding entire URL paths or full URLs. Use component mode when you're building query strings and URL mode when you're encoding a complete URL. The batch mode lets you encode or decode multiple lines at once, which is useful when you have a list of URLs or parameters to process. Each line is treated as a separate input, and all results are displayed together for easy copying.

Frequently Asked Questions

Why do URLs need encoding?
URLs can only contain certain ASCII characters. Characters like spaces, &, ?, #, and non-ASCII characters must be encoded (percent-encoded) to ensure safe transmission over the internet.
What is percent-encoding?
Percent-encoding replaces unsafe characters with a % sign followed by their two-digit hexadecimal code. For example, a space becomes %20 and & becomes %26.
Is URL encoding the same as HTML encoding?
No. URL encoding (percent-encoding) is for URLs. HTML encoding uses entities like &amp; for & or &lt; for <. They serve different purposes in web development.
When should I use URL mode versus component mode?
Use component mode when encoding a single query parameter value (e.g., a search term). Use URL mode when encoding a full URL path or when you need the entire string to be URL-safe. Component mode encodes more characters because it assumes the value will be placed inside a URL structure.
Why does encoding 'Hello World' give 'Hello%20World' instead of 'Hello+World'?
In URL path segments, spaces are encoded as %20. The + encoding for spaces is only used in application/x-www-form-urlencoded data (HTML form submissions). Modern best practice is to use %20 consistently in URLs. The calculator uses %20 for URL encoding.
Can I encode non-ASCII characters like emoji or accented letters?
Yes. Non-ASCII characters are first converted to UTF-8 bytes, then each byte is percent-encoded. For example, the emoji ☺ (U+1F600) becomes %F0%9F%98%80. Accented characters like é (U+00E9) become %C3%A9. This is the standard approach defined in RFC 3986.
What's the difference between this and HTML entity encoding?
URL encoding (percent-encoding) is for URLs — it converts characters to %XX hex codes. HTML entity encoding converts characters to named or numeric entities like &amp; for & or &#8364; for €. They serve completely different purposes and are not interchangeable.
Why do some URLs work without encoding even though they contain special characters?
Modern browsers automatically encode URLs when you navigate to them or submit forms. However, when you're constructing URLs programmatically (in code, API calls, or server-side redirects), you must encode manually because the server won't do it for you.
Is there a risk of double-encoding?
Yes. If you encode a URL that's already been encoded, %20 becomes %2520, which is incorrect. Always check whether your input is already encoded before encoding again. This calculator shows the decoded output so you can verify the result is correct.
How do I handle encoded URLs in JavaScript?
Use decodeURIComponent() to decode and encodeURIComponent() to encode individual values. For full URLs, use decodeURI() and encodeURI() which preserve the URL structure characters (/, ?, #, etc.). Never use escape() or unescape() — they're deprecated and don't handle Unicode correctly.

Discover More Tools

Fresh picks from across our tool library.