What is URL encoding?
URL encoding (also called percent encoding) is a method of encoding special characters in URLs so they can be safely transmitted over the internet. URLs can only contain certain characters from the ASCII character set, including letters, digits, and a few special characters like - . _ ~. Any other character, including spaces, accents, and symbols, must be encoded as a percent sign (%) followed by its hexadecimal ASCII value. For example, a space is encoded as %20, an ampersand (&) is %26, and a forward slash (/) is %2F.
URL encoding is essential for query parameters, form submissions, and API calls. When you submit a form or click a link with parameters, the browser automatically encodes the values. However, if you are manually constructing URLs or working with APIs, understanding URL encoding helps you correctly format data.
URL decoding is the reverse process: converting percent-encoded characters back to their original form. For example, %3Fquery%3Dvalue decodes to ?query=value. This tool handles both encoding and decoding, making it easy to work with URLs programmatically.
When should you use the URL Encoder/Decoder?
Creating API query parameters: When building API requests with query strings, you must encode special characters in parameter values. For example, if a search query contains spaces or punctuation, encoding ensures the URL is valid.
Sharing URLs with special characters: If you have a URL with spaces, accents, or other special characters, encoding makes it safe to share via email or messaging apps where URL parsing might fail.
Debugging API requests: When troubleshooting why an API call is failing, decode the URL to see the actual parameter values. This helps identify if encoding or decoding errors are the problem.
Form submission handling: When submitting HTML forms, browsers automatically encode the data, but understanding this process helps you debug form-related issues.
Building redirect URLs: In authentication flows and OAuth implementations, redirect URLs with query parameters must be properly encoded to ensure they work correctly.
Storing URLs in databases: URLs should be stored in their encoded form to ensure they are valid and can be retrieved and used without modification.
Working with internationalized domain names: URLs with non-ASCII characters must be encoded before transmission, a process called Punycode encoding.
How to use the URL Encoder/Decoder
Step 1: Paste your URL or parameter value into the input field. You can encode a full URL or just the parameter values.
Step 2: The tool will detect whether you want to encode or decode. If the input looks like encoded data (contains % signs), it will default to decoding. Otherwise, it will encode.
Step 3: For encoding, the tool converts special characters to their percent-encoded equivalents. Spaces become %20, ampersands become %26, and so on.
Step 4: For decoding, the tool converts percent-encoded characters back to their original form. %20 becomes a space, %26 becomes &, etc.
Step 5: Copy the result and use it in your URL, API request, or application.
Step 6: Test the result by pasting it into your browser address bar or API client to verify it works as expected.
Step 7: If you are building API queries, remember that different characters have different encoding values. Refer to ASCII tables or use this tool to look up specific characters.
Common errors and how to fix them
Error: Double encoding. If you encode already-encoded data, you end up with double encoding (for example, %2520 instead of %20). Always start with raw data. Decode first if you are unsure whether data is already encoded.
Error: Spaces encoded differently. Spaces can be encoded as %20 or as + (in query parameters). Most modern tools use %20, but some legacy systems use +. Ensure your application handles the format it expects.
Error: Reserved characters encoded incorrectly. In URLs, some characters like / : ? # are reserved and have special meaning. Whether they should be encoded depends on context. In paths, slashes usually are not encoded, but in query values, they should be.
Error: Accented characters not supported. If you are trying to encode accented characters (é, ñ, ü) or non-ASCII characters, ensure you are using UTF-8 encoding, not ASCII.
Error: Plus signs in decoded output. If you decode a query string and see + instead of spaces, this is correct for query strings (+ encodes space in query parameters). If you need spaces, convert + to %20 first.
Related tools
Base64 Encoder/Decoder: While Base64 and URL encoding are different, both are used for encoding data. Use Base64 for general binary data and URL encoding for URLs and query parameters.
QR Code Generator: Generate QR codes for encoded URLs. This makes it easy to share complex URLs via QR codes instead of typing them.
JSON Formatter: When working with APIs that use JSON with URL-encoded query parameters, use the JSON Formatter to prettify responses.