URL Encoder & Decoder - Online URL Tool
Free online URL encoder and decoder. Encode and decode URLs with percent encoding. Perfect for web developers and API testing. Safe transmission of URLs with special characters.
Text to Encode
Input Statistics
URL-encoded Output
About URL Encoding
Component Encoding
Uses encodeURIComponent(). Encodes all characters except: A-Z a-z 0-9 - _ . ! ~ * ' ( )
Query String Encoding
Similar to component encoding but can preserve spaces as + characters for form data.
Full URL Encoding
Uses encodeURI(). Preserves URL structure characters: : / ? # [ ] @
Frequently Asked Questions
What is URL encoding (percent encoding)?
URL encoding is a method to convert characters into a format that can be transmitted over the Internet. Special characters are replaced with a percent sign (%) followed by their hexadecimal representation.
When should I use URL encoding?
Use URL encoding when your URLs contain special characters like spaces, symbols, or non-ASCII characters. This ensures the URL is transmitted correctly across different systems and browsers.
What's the difference between encodeURI and encodeURIComponent?
encodeURI() preserves URL structure characters (like :, /, ?) while encodeURIComponent() encodes all special characters. Use encodeURI() for full URLs and encodeURIComponent() for URL parameters.
Is this URL encoding tool secure?
Yes, this tool is completely secure. All encoding and decoding happens locally in your browser - no URLs or data are sent to external servers. Your data remains completely private.
What is URL Encoding (Percent Encoding)?
URL encoding, also known as percent encoding, is the process of converting special characters and non-ASCII characters into a format that can be safely transmitted over the Internet. URLs traditionally can only contain ASCII characters from a limited safe set (A-Z, a-z, 0-9, hyphen, underscore, period, and tilde). Any character outside this set must be encoded as a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20, an ampersand (&) becomes %26, and a forward slash (/) becomes %2F. RFC 3986 defines exactly which characters must be encoded and which can remain unencoded.
Different parts of a URL have different encoding rules. The full URL structure (scheme, domain, path, query, fragment) has reserved characters that mean something special (: / ? # [ ] @), so these should not be encoded in their structural positions but must be encoded if they appear in data. This is why there are two encoding methods: encodeURI() for full URLs preserves structure characters, while encodeURIComponent() for individual components encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ).
Common Use Cases
- Building Query Strings: Encode query parameters when building URLs with special characters. For example, a search query like "hello world&co" becomes "hello%20world%26co" and can be safely appended as ?q=hello%20world%26co.
- Encoding Form Data: HTML forms submit data with URL encoding when using application/x-www-form-urlencoded MIME type. Spaces become + and special characters become %XX, allowing form values to be transmitted safely in URLs.
- API Request Construction: When building API requests with user input, encode parameters to prevent breaking the URL syntax or accidentally triggering special characters. An API endpoint like /users?name=John%20Doe handles spaces in names correctly.
- Debugging URL Parsing Issues: Web servers and frameworks receive encoded URLs and must decode them. Understanding URL encoding helps debug why spaces become %20, why & appears as %26, and why your decoded values are different from what you expected.
- Encoding File Paths in URLs: When file names contain special characters, spaces, or Unicode characters, they must be encoded for transmission. This is critical for file download links, file upload endpoints, and REST APIs that manipulate file resources.
How to Use This Tool
- Choose Mode: Select Encode to convert plain text to URL-encoded format, or Decode to convert URL-encoded text back to plain text. The Auto-detect button intelligently identifies which mode is needed.
- Select Encoding Type (Encode Only): Choose between Component encoding (encodes everything except unreserved chars), Full URL encoding (preserves URL structure), or Query String encoding (uses + for spaces).
- Paste or Type Input: Enter your text in the input field. For decoding, paste URL-encoded text. The tool validates input in real-time and shows encoding detection.
- View Output: The encoded or decoded result appears in the output field. Statistics show character count, word count, lines, and byte size for both input and output.
- Copy or Download: Use Copy to clipboard, Swap to reverse input/output, or Download to save as a file. Size comparison shows how much the encoding expanded the data.
Features
Multiple Encoding Types
Support for Component (encodeURIComponent), Full URL (encodeURI), and Query String encoding. Each type has different rules for which characters are preserved versus encoded.
Bidirectional Conversion
Encode plain text to URL-safe format or decode encoded text back to readable form. Auto-detect mode intelligently determines which operation is needed based on input.
Real-Time Statistics
View character count, word count, line count, and byte size for both input and output. Size comparison shows the encoding overhead percentage to understand data expansion.
Input Validation
Real-time validation detects malformed URL encoding (invalid %XX sequences). Invalid input highlights are shown with helpful error messages.
Frequently Asked Questions
What is URL encoding and why is it necessary?
URL encoding converts special characters into a format that can be transmitted over the Internet. URLs can only contain ASCII characters from a safe set; spaces, punctuation, and non-ASCII characters must be encoded. Without URL encoding, spaces would break URLs, ampersands would be ambiguous, and special characters could be misinterpreted by browsers and servers.
What characters need to be URL-encoded?
The unreserved characters (A-Z, a-z, 0-9, hyphen, underscore, period, tilde) don't need encoding. All other characters must be encoded, including spaces, punctuation, Unicode, and symbols. Reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) don't need encoding in their structural positions but must be encoded if they appear as data.
What is the difference between %20 and + in URLs?
Both %20 and + represent a space, but in different contexts. %20 is the standard percent-encoding for spaces and works everywhere. The + character only represents a space in application/x-www-form-urlencoded data (HTML form submissions). In URL query parameters, %20 is more reliable; use + only when explicitly handling form data.
How do I encode a full URL vs just a query parameter?
Use Full URL encoding (encodeURI) for complete URLs—it preserves colons (:), slashes (/), and question marks (?) so the URL structure stays intact. Use Component encoding (encodeURIComponent) for individual parameters—it encodes everything, which you need when inserting user input into URLs. Always encode individual parameters; only use full URL encoding on complete URLs.
What is double URL encoding?
Double encoding occurs when you encode already-encoded data. For example, %20 (encoded space) gets encoded again to %2520. This typically happens when data passes through multiple encoding layers. Always decode once before re-encoding to avoid this issue. Many APIs and security vulnerabilities stem from mishandled double encoding.