URL Encode/Decode

Encode and decode URLs for web development. Convert special characters to URL-safe format and back.

What It Does

URL Encoder/Decoder (also called Percent Encoder) converts text into URL-safe format by encoding special characters as percent-encoded sequences, and decodes encoded URLs back to readable text. URL encoding (percent encoding) is essential because URLs can only contain a limited set of characters safely: letters, digits, and a few special characters like hyphens and underscores. Characters like spaces, ampersands, equals signs, and non-ASCII characters must be encoded as percent sequences (e.g., space becomes %20, & becomes %26). This tool handles encoding for query parameters, path segments, fragment identifiers, and entire URLs. It properly encodes spaces, special characters, Unicode characters, and reserved URL characters. Essential for web development, API integration, form submissions, OAuth callbacks, and any scenario where user input or dynamic data needs to be safely included in URLs without breaking URL structure or causing security issues.

Key Features:

  • URL encoding: Convert special characters to percent-encoded format (%20, %26, etc.)
  • URL decoding: Convert percent-encoded URLs back to readable text
  • Query parameter handling: Properly encode values for URL query strings
  • Unicode support: Encode international characters and emoji
  • Full URL encoding: Encode entire URLs or just specific parts
  • Reserved character handling: Encode characters with special URL meanings
  • Instant conversion: Real-time encoding/decoding as you type
  • Copy functionality: One-click copy of encoded/decoded results

How To Use

Paste your URL or text, choose encode or decode, and get instant results. Perfect for API development, form handling, and URL construction.

1

Enter URL or Text

Paste the URL or text you want to encode or decode into the input field. For encoding: Enter text with special characters, spaces, or Unicode characters that need to be URL-safe. For decoding: Paste a URL or string containing percent-encoded sequences (like %20, %26, %3D).

2

Choose Encode or Decode

Click "Encode URL" to convert special characters to percent-encoded format (e.g., "hello world" becomes "hello%20world"). Click "Decode URL" to convert percent-encoded sequences back to readable characters (e.g., "hello%20world" becomes "hello world").

3

View Results

The encoded or decoded result appears instantly. Encoded URLs are safe to use in web browsers, API requests, or anywhere URLs are required. Decoded text shows the original readable content.

4

Copy and Use

Click the copy button to copy the result to your clipboard. Use encoded URLs in API requests, HTML links, or query parameters. Use decoded text to understand what encoded URLs actually contain.

Pro Tips

  • Always encode user input before adding to URLs to prevent injection attacks
  • Spaces become %20, but + is also accepted for spaces in query strings
  • Reserved characters like &, =, ?, # have special meanings and should be encoded
  • Unicode characters are encoded as UTF-8 bytes then percent-encoded
  • Already encoded URLs can be decoded to see their readable form
  • Different URL parts (path, query, fragment) may need different encoding rules

Benefits

URL Safety: Prevent broken URLs from special characters
Security: Encode user input to prevent URL injection attacks
API Integration: Properly format query parameters for API requests
Form Handling: Encode form data for GET requests and query strings
International Support: Handle Unicode characters in URLs
Debugging: Decode encoded URLs to understand their structure
OAuth: Encode callback URLs and parameters for OAuth flows

Use Cases

API Query Parameters

Encode query parameter values in API requests. Example: Search query "coffee & tea" must be encoded as "coffee%20%26%20tea" in URL: https://api.example.com/search?q=coffee%20%26%20tea. Without encoding, the & character would be interpreted as a parameter separator, breaking the URL. Essential for all API integrations.

Query: "coffee & tea" → Encoded: "coffee%20%26%20tea"

Form Data in URLs

Encode form data when submitting via GET method. Example: Form with name="John Doe" and email="john@example.com" becomes: ?name=John%20Doe&email=john%40example.com. The space becomes %20, @ becomes %40. Essential for URL-based form submissions and search functionality.

Form data → URL: ?name=John%20Doe&email=john%40example.com

OAuth Callback URLs

Encode OAuth callback URLs and state parameters. Example: Callback URL with state parameter must be encoded: https://app.com/callback?state=encoded_state_value. OAuth providers require proper URL encoding for security and parameter handling.

Callback: /callback?state=user%3D123%26return%3Dhome

International URLs

Encode Unicode characters in URLs. Example: URL with Chinese characters "搜索" is encoded as "%E6%90%9C%E7%B4%A2". Unicode characters are first converted to UTF-8 bytes, then percent-encoded. Essential for international websites and multilingual content.

Chinese: "搜索" → Encoded: "%E6%90%9C%E7%B4%A2"

Frequently Asked Questions

1 What characters need to be URL encoded?
Characters that MUST be encoded: Reserved characters with special URL meanings: : / ? # [ ] @ ! $ & ' ( ) * + , ; = and space. Unreserved characters that DON'T need encoding: A-Z, a-z, 0-9, and - _ . ~. Additionally, any non-ASCII characters (Unicode) should be encoded. As a rule of thumb: if a character isn't a letter, digit, hyphen, underscore, period, or tilde, encode it. When in doubt, encode it—over-encoding is safe, under-encoding breaks URLs. Some characters like spaces can be encoded as %20 or + (in query strings), but %20 is more universally safe.
2 What's the difference between encoding the whole URL vs just parts?
Different URL parts have different encoding rules: Protocol (http://) and domain (example.com) should NOT be encoded—they must remain readable. Path segments (/path/to/page) should encode spaces and special chars but preserve slashes. Query parameters (?key=value) should encode the values but preserve ? and & separators. Fragment (#section) should encode the fragment value but preserve #. Generally, encode: user input, dynamic values, file names, search queries. Don't encode: URL structure (://, /, ?, &, #), domain names, protocol names. Our tool can encode entire URLs (useful for encoding URLs that will be used as parameter values) or just specific parts.
3 Why does my encoded URL look different in the browser?
Browsers automatically decode URLs in the address bar for display, but the actual HTTP request uses the encoded version. When you see "hello world" in the browser bar, the actual request uses "hello%20world". Browsers also handle some encoding automatically when you type URLs, but for programmatic URL construction (JavaScript, APIs), you must manually encode. Additionally, browsers may display some characters differently: + and %20 both represent spaces in query strings, and browsers may show either. The underlying encoded format is what matters for actual requests.
4 Can I encode already-encoded URLs?
Yes, but it's usually unnecessary and can cause double-encoding issues. If you encode "hello%20world" again, you get "hello%2520world" (% becomes %25). Double-encoding makes URLs longer and harder to decode. Generally, only encode once: raw user input → encoded URL. If you receive an already-encoded URL and need to add more parameters, decode it first, add your parameters, then encode the whole thing. Or, more safely, parse the URL, encode only your new parameter values, and reconstruct the URL properly. Our decoder helps identify if a URL is already encoded.
5 How are Unicode characters encoded in URLs?
Unicode characters are encoded in two steps: First, convert the Unicode character to UTF-8 bytes. For example, "é" (U+00E9) becomes bytes C3 A9 in UTF-8. Second, percent-encode each byte: C3 becomes %C3, A9 becomes %A9, resulting in "%C3%A9". This ensures URLs work with systems that only understand ASCII. The process is: Unicode → UTF-8 bytes → percent encoding. Our tool handles this automatically—just paste Unicode text and it encodes correctly. When decoding, the reverse happens: percent sequences → UTF-8 bytes → Unicode characters.

Related Tools