devBylund.com

URL Encoder/Decoder

Encode and decode URLs and URI components safely

URL encoding converts special characters to percent-encoded format (%XX) for safe transmission in URLs. Essential for query parameters, form data, and API requests.

Input Text
Enter text or URL to encode/decode
Real-time Processing
RFC 3986 Compliant
URL Encoded
Percent-encoded format for URLs
Encoded output will appear here...
URL Decoded
Original readable format
Decoded output will appear here...
About URL Encoding

URL encoding (also called percent encoding) is a mechanism for encoding information in a URI that uses a restricted character set. Characters that are not allowed in URLs are converted to a percent sign followed by two hexadecimal digits.

Characters that need encoding:

Space%20
!%21
"%22
#%23
$%24
%%25
&%26
+%2B

Common Use Cases:

  • Query parameters in URLs
  • Form data submission
  • API request parameters
  • Email addresses with special characters
  • File paths with spaces or special characters

💡 Note: URL encoding is different from HTML entity encoding. Use this tool specifically for URLs and URI components.

Usage Examples

JavaScript

// URL encoding
const encoded = encodeURIComponent("hello world & more");
console.log(encoded); // "hello%20world%20%26%20more"

// URL decoding
const decoded = decodeURIComponent("hello%20world%20%26%20more");
console.log(decoded); // "hello world & more"

// Building URLs with parameters
const baseUrl = "https://api.example.com/search";
const query = "coffee & tea";
const fullUrl = baseUrl + "?q=" + encodeURIComponent(query);

Python

import urllib.parse

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

# URL decoding
decoded = urllib.parse.unquote("hello%20world%20%26%20more")
print(decoded)  # "hello world & more"

# For query parameters
params = urllib.parse.urlencode({'q': 'coffee & tea', 'limit': 10})
print(params)  # "q=coffee+%26+tea&limit=10"

PHP

// URL encoding
$encoded = urlencode("hello world & more");
echo $encoded; // "hello+world+%26+more"

// URL decoding
$decoded = urldecode("hello+world+%26+more");
echo $decoded; // "hello world & more"

// Raw URL encoding (for path components)
$encoded = rawurlencode("hello world & more");
echo $encoded; // "hello%20world%20%26%20more"