URL Encoder/Decoder

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

Output appears here...

Statistics

0
Input chars
0 bytes
0
Output chars
0 bytes
0
Encoded
0 special

URL Breakdown

Enter a valid URL to see breakdown

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)

Frequently Asked Questions

How to url encode a string?

To URL encode a string, paste it into the utilAZ URL Encoder input field and the tool instantly converts unsafe characters to their percent-encoded equivalents. Programmatically, use encodeURIComponent() in JavaScript or urllib.parse.quote() in Python. Each non-safe character is converted to a percent sign followed by its two-digit hexadecimal ASCII or UTF-8 byte value. For example, a space becomes %20, an ampersand becomes %26, and a non-ASCII character like e-acute becomes %C3%A9.

What is percent encoding in urls?

Percent encoding (also called URL encoding) is the mechanism defined in RFC 3986 for representing unsafe or reserved characters inside a URI. Each byte of the character's UTF-8 representation is written as a percent sign followed by two uppercase hex digits. Safe characters (A-Z, a-z, 0-9, hyphen, underscore, period, tilde) pass through unchanged. All other characters, including spaces, ampersands, question marks, and non-ASCII letters, must be percent-encoded so that servers and browsers parse the URL correctly.

How to decode url encoded text?

To decode URL encoded text, paste the percent-encoded string into the utilAZ URL Decoder and it will convert sequences like %20 back to spaces, %26 back to ampersands, and multi-byte sequences like %C3%A9 back to their original Unicode characters. In code, use decodeURIComponent() in JavaScript or urllib.parse.unquote() in Python. The decoder reads each %XX triplet, converts the hex value to its byte, then reassembles multi-byte UTF-8 sequences into the original characters.

Why do urls have percent signs?

URLs have percent signs because the URI specification only allows a limited set of ASCII characters in a raw URL. Characters outside that safe set, such as spaces, ampersands, non-English letters, and control characters, must be escaped so they are not confused with URL delimiters. The percent sign acts as an escape indicator: the two hex digits following it represent the byte value of the original character. This ensures URLs are transmitted and parsed identically across all systems, browsers, and protocols.

How to encode query parameters?

To encode query parameters, apply encodeURIComponent() (JavaScript) or urllib.parse.quote() (Python) to each parameter name and value individually, then join them with ampersands. Do not encode the entire URL or the structural characters (?, =, &) that separate parameters. For example, build the string as key1=encodeURIComponent(value1)&key2=encodeURIComponent(value2). The utilAZ URL Encoder handles this automatically, showing you both the individual encoded components and the assembled query string.

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

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