Encode text to URL-safe format or decode percent-encoded strings.
URL encoding (also called percent encoding) converts special and reserved characters into a format that can be safely transmitted over the internet. URLs have specific rules about which characters are allowed in different parts—some characters have special meaning in URLs and must be escaped to avoid confusion or errors. A space becomes %20, an ampersand becomes %26, a forward slash becomes %2F, and other characters are replaced with a percent sign (%) followed by their hexadecimal ASCII value. URL encoding is essential for query parameters, form data, and URLs containing non-ASCII characters, spaces, or symbols. Without proper URL encoding, special characters can be misinterpreted, breaking links or causing security vulnerabilities. This tool makes encoding and decoding instant, allowing you to work with URLs confidently.
URLs follow a specific structure: scheme://authority/path?query#fragment. Each part has different rules about which characters are allowed without encoding. The scheme and authority parts are usually straightforward, but the path, query, and fragment require careful handling of special characters. Reserved characters like ! # $ & ' ( ) * + , / : ; = ? @ [ ] have special meaning in URLs. For example, & separates query parameters, so if your data contains an ampersand, it must be encoded as %26 to avoid creating unintended parameter boundaries. The forward slash / separates path segments, so encoding it as %2F prevents it from being treated as a path boundary.
Unreserved Characters: Letters (A-Z, a-z), digits (0-9), and three special characters (-, _, .) never need encoding. The tilde (~) is also unreserved but sometimes encoded for compatibility. All other characters must be percent-encoded to be URL-safe.
Percent Encoding Mechanism: Each character is converted to its UTF-8 byte representation, then each byte is represented as %HH where HH is the two-digit hexadecimal value. For ASCII characters, this is straightforward—space is 0x20 (32 in decimal), becoming %20. For non-ASCII Unicode characters, UTF-8 encoding produces multiple bytes, each encoded separately. For example, the copyright symbol © becomes %C2%A9 in UTF-8 encoding.
The URL encoder provides a simple two-way conversion interface. Enter text in the input field—it can be plain text, a URL, query string parameters, or any combination. Click "Encode →" to convert all special characters to percent-encoded format. The output appears immediately in the output field with all spaces, symbols, and non-ASCII characters safely encoded. Click "← Decode" to reverse the process, converting percent-encoded text back to readable characters. The "Swap" button quickly exchanges input and output, useful if you want to continue working with the result. The "Copy" button copies the output to your clipboard with a single click, and "Clear" resets both fields. Use this tool whenever you need to prepare data for URLs, prepare URLs from user input, or verify that URL encoding is correct before submitting API requests or building dynamic links.
Query String Parameters: When building dynamic URLs with search parameters, user input must be encoded. A search query like "how to code" needs encoding because spaces aren't allowed in URLs. The encoded form becomes "how%20to%20code" in the query string. If you're building a URL like example.com/search?q=how%20to%20code, encode the search term to ensure it works correctly. This is especially important if the search term contains special characters like & or =.
API Request Parameters: REST APIs receive parameters through URLs, requiring proper encoding. A user's name like "José García" must be encoded as "Jos%C3%A9%20Garc%C3%ADa" when passed as a URL parameter. API endpoints often expect encoded input—failure to encode can result in 400 Bad Request errors. Tools and libraries usually handle this automatically, but understanding the underlying encoding helps debug issues when they occur.
Shareable Links: When creating shareable links with user-supplied content, proper encoding ensures the link works correctly when shared. A tweet with a URL containing spaces, a shared document name with special characters, or a form submission with unusual input all require proper encoding. This tool helps verify your links are correctly formatted before sharing.
Form Data Transmission: HTML forms use URL encoding (application/x-www-form-urlencoded) by default. When a user submits a form with text fields, the browser automatically encodes the data. Understanding URL encoding helps debug form submission issues and build custom form handlers that properly decode incoming data.
Webhook and Callback URLs: When registering webhook endpoints or OAuth redirect URLs with external services, special characters in parameters must be encoded. A callback URL like https://example.com/callback?state=user@example.com&user=john must encode the @ and = symbols to avoid parsing errors in the service receiving the callback.
RFC 3986 defines the standards for Uniform Resource Identifiers (URIs), including URL encoding rules. The standard specifies which characters are "unreserved" (never need encoding) and which are "reserved" (may need encoding depending on context). This tool follows RFC 3986 standards, using the encodeURIComponent function in JavaScript, which encodes all characters except these: A-Z a-z 0-9 - _ . ~ (the tilde is technically unreserved per RFC 3986).
Encoding vs Decoding: Encoding converts readable text to percent-encoded format for transmission. Decoding reverses this process. The two operations must be inverses of each other—encoding then decoding should return the original text unchanged. This tool ensures perfect symmetry between encode and decode operations.
UTF-8 and Unicode: URLs support any character, but each character must be converted to UTF-8 bytes before percent-encoding. UTF-8 uses variable-length byte sequences—ASCII characters use one byte, but characters like é use two bytes, and characters like 中 use three bytes. Each byte becomes a separate %HH sequence. For example: A (ASCII) = %41, é (Latin) = %C3%A9, 中 (CJK) = %E4%B8%AD. This tool handles all Unicode correctly, automatically converting to UTF-8 and then percent-encoding each byte.
Q: When should I encode vs not encode?
A: Encode user-supplied text and special characters. Don't encode unreserved characters (letters, digits, -, _, ., ~) or characters that should be interpreted literally. The path separators (/) in URLs are typically not encoded in the path section but are encoded when they're data (like a filename). Most programming frameworks handle this automatically—only use manual encoding when building URLs by hand or debugging.
Q: Why does my URL work without encoding?
A: Browsers are lenient and encode URLs automatically in many cases. However, this can cause unexpected behavior or errors with certain characters. It's best practice to always encode properly rather than rely on browser leniency. Additionally, programmatic URL handling (APIs, scripts, etc.) is stricter and will fail with unencoded special characters.
Q: What's the difference between %20 and + for spaces?
A: In query strings specifically, %20 and + both represent spaces. However, + only works in query strings (after the ? in the URL). In other URL parts, + means literally +, not a space. The %20 encoding works everywhere, so it's always safer. Use %20 unless you're specifically working with query string encoding conventions.
Q: Can I encode only certain characters?
A: This tool encodes all special characters for maximum compatibility. Some tools offer options to encode selectively, but it's safer to encode comprehensively. If you need partial encoding for specific purposes, consider using a programming language directly rather than manual tools.
Q: Is URL encoding the same as HTML encoding?
A: No, they're different. URL encoding handles characters in URLs. HTML encoding handles special characters in HTML content (like < for <, & for &). They serve different purposes and use different encodings. Use URL encoding for URLs and HTML encoding for HTML content.
Q: How do I handle multiple parameters?
A: Each parameter's key and value should be encoded separately, then combined with = and & separators. For example: encode("name")=encode("John Doe") & encode("email")=encode("john@example.com"). Most web frameworks handle this automatically when you use their URL-building functions.
Use Framework Tools: Don't manually build URLs in production code. Use your framework's URL-building functions (encodeURIComponent in JavaScript, urllib in Python, URLEncoder in Java, etc.). These handle encoding correctly and protect against security issues like URL injection attacks.
Double-Check API Documentation: Some APIs have specific encoding requirements. Check if they expect query parameters to be encoded, what characters they support, and whether they have special handling for certain characters. Variations exist—follow the documentation exactly.
Test with Special Characters: When testing APIs or URL handling, test with various special characters, spaces, ampersands, and international characters. This reveals encoding issues early. Use this tool to prepare test cases with properly encoded values.
Prefer Modern Standards: Use RFC 3986 encoding (percent encoding) over older URL encoding variants. This ensures maximum compatibility across systems, APIs, and programming languages. The tool follows these standards, so you can rely on its output.