Testing Environment: Our tools are currently under heavy testing. You may experience slower performance or temporary issues.

πŸ”—

URL Encoder/Decoder

Encode and decode URLs for safe transmission in web applications and APIs

URL Encoder

Characters: 0

Common Examples

πŸ”— Component Encoding

β€’ Use for: Query parameters, form data
β€’ Encodes: All special characters
β€’ Preserves: Letters, numbers, -_.~
β€’ Method: encodeURIComponent()
β€’ Safe for: Any part of URL structure

🌐 Full URI Encoding

β€’ Use for: Complete URLs
β€’ Preserves: :/?#[]@!$&'()*+,;=
β€’ Encodes: Spaces, Unicode, unsafe chars
β€’ Method: encodeURI()
β€’ Maintains: URL structure

πŸ“ Form Encoding

β€’ Use for: Form submissions
β€’ Spaces: Become + instead of %20
β€’ Content-Type: x-www-form-urlencoded
β€’ Legacy: HTML form standard
β€’ Modern: Use %20 for consistency

About URL Encoding and Decoding

URL encoding (percent encoding) converts special characters in URLs to a safe format that can be transmitted over the internet. This process replaces unsafe characters with percent signs followed by hexadecimal values. URL decoding reverses this process. Our tool handles both operations for query parameters, path segments, and full URLs.

  • Encode special characters for safe URL transmission
  • Decode percent-encoded URLs back to readable text
  • Handle query parameters and path components
  • Support for international characters and Unicode
  • Component-level and full URL encoding options

URL Encoding Rules

Reserved Characters

  • Space: %20 or + (in query strings)
  • & (ampersand): %26
  • ? (question mark): %3F
  • # (hash): %23
  • = (equals): %3D
  • + (plus): %2B

Safe Characters

  • Letters: A-Z, a-z (unchanged)
  • Numbers: 0-9 (unchanged)
  • Hyphens: - (unchanged)
  • Periods: . (unchanged)
  • Underscores: _ (unchanged)
  • Tildes: ~ (unchanged)

Advertisement

AdSense Banner Ad Placeholder

Frequently Asked Questions

When should I URL encode data?

URL encode data when passing it as query parameters, form data, or any part of a URL that might contain special characters. This includes user input, search queries, file names, and international text. Always encode before sending HTTP requests to prevent parsing errors.

What's the difference between component and full URL encoding?

Component encoding (encodeURIComponent) encodes all special characters including slashes and colons, making it safe for query parameters. Full URL encoding (encodeURI) preserves URL structure characters like slashes and colons, suitable for encoding complete URLs while maintaining their functionality.

Why do spaces become %20 or + in URLs?

Spaces become %20 in URL paths and components, and can become + in query string parameters (legacy behavior). Modern applications typically use %20 consistently. The + encoding is from HTML form submissions, but %20 is more universal and recommended.

Can I double-encode URLs?

Yes, but it's usually unintentional and causes problems. Double encoding happens when already-encoded data gets encoded again (e.g., %20 becomes %2520). Always check if data is already encoded before applying additional encoding to avoid this issue.

URL Encoding Examples

Common Encoding Scenarios:

Search Queries:
Original: "web development tutorial"
Encoded: web%20development%20tutorial
Original: "React & Vue comparison"
Encoded: React%20%26%20Vue%20comparison
Original: "JavaScript: The Good Parts"
Encoded: JavaScript%3A%20The%20Good%20Parts
File Names:
Original: "resume 2024.pdf"
Encoded: resume%202024.pdf
Original: "project#1_final.zip"
Encoded: project%231_final.zip
Original: "data (backup).json"
Encoded: data%20%28backup%29.json
International Text:
Original: "cafΓ© ParΓ­s"
Encoded: caf%C3%A9%20Par%C3%ADs
Original: "εŒ—δΊ¬εΈ‚"
Encoded: %E5%8C%97%E4%BA%AC%E5%B8%82
Original: "MΓΌnchen"
Encoded: M%C3%BCnchen
Query Parameters:
Original: ?search=hello world&category=tech
Encoded: ?search=hello%20world&category=tech
Original: ?filter=price>100&sort=name
Encoded: ?filter=price%3E100&sort=name
Original: ?callback=http://example.com/cb
Encoded: ?callback=http%3A//example.com/cb

Sponsored Content

AdSense Square Ad Placeholder

Programming Implementation

JavaScript:

// Component encoding (for query parameters)
const component = "hello world & more!";
const encoded = encodeURIComponent(component);
console.log(encoded); 
// "hello%20world%20%26%20more!"

const decoded = decodeURIComponent(encoded);
console.log(decoded); 
// "hello world & more!"

// Full URI encoding (preserves structure)
const uri = "https://example.com/search?q=hello world";
const encodedURI = encodeURI(uri);
console.log(encodedURI);
// "https://example.com/search?q=hello%20world"

// Building query strings
function buildQuery(params) {
  return Object.keys(params)
    .map(key => 
      encodeURIComponent(key) + '=' + 
      encodeURIComponent(params[key])
    )
    .join('&');
}

const params = { name: "John Doe", age: 30, city: "New York" };
console.log(buildQuery(params));
// "name=John%20Doe&age=30&city=New%20York"

Python:

import urllib.parse

# URL component encoding
component = "hello world & more!"
encoded = urllib.parse.quote(component)
print(encoded)  
# "hello%20world%20%26%20more%21"

decoded = urllib.parse.unquote(encoded)
print(decoded)  
# "hello world & more!"

# Query parameter encoding
params = {
    'name': 'John Doe',
    'age': '30',
    'city': 'New York'
}
query_string = urllib.parse.urlencode(params)
print(query_string)
# "name=John+Doe&age=30&city=New+York"

# Parse and encode URLs
from urllib.parse import urlparse, urlunparse, quote

url = "https://example.com/path with spaces"
parsed = urlparse(url)
encoded_path = quote(parsed.path)
safe_url = urlunparse(parsed._replace(path=encoded_path))
print(safe_url)
# "https://example.com/path%20with%20spaces"

Character Encoding Reference

Common Symbols:

Space β†’ %20
! β†’ %21
# β†’ %23
$ β†’ %24
% β†’ %25
& β†’ %26
' β†’ %27
( β†’ %28
) β†’ %29
+ β†’ %2B

Punctuation:

, β†’ %2C
/ β†’ %2F
: β†’ %3A
; β†’ %3B
= β†’ %3D
? β†’ %3F
@ β†’ %40
[ β†’ %5B
] β†’ %5D
{{ β†’ %7B

Extended ASCII:

| β†’ %7C
}} β†’ %7D
~ β†’ %7E
" β†’ %22
< β†’ %3C
> β†’ %3E
\ β†’ %5C
^ β†’ %5E
` β†’ %60
DEL β†’ %7F

URL Encoding Best Practices

Encoding Guidelines:

βœ“ Always encode user input: Never trust raw user data
βœ“ Choose correct method: Component vs full URI encoding
βœ“ Handle Unicode properly: Use UTF-8 encoding
βœ“ Check for double encoding: Don't encode twice
βœ“ Validate after decoding: Check decoded data
βœ“ Use standard libraries: Avoid custom implementations

Common Pitfalls:

βœ— Forgetting to encode: Causes parsing errors
βœ— Wrong encoding method: Breaks URL structure
βœ— Double encoding: %20 becomes %2520
βœ— Platform differences: + vs %20 for spaces
βœ— Character set issues: Non-UTF8 encoding
βœ— Security bypass: Using encoding to hide attacks

Common Use Cases

  • Form data transmission
  • Search query parameters
  • API endpoint construction
  • File upload handling
  • Social media sharing URLs
  • Email link generation
  • Analytics tracking parameters
  • Internationalization support

Advertisement

AdSense Bottom Ad Placeholder