Skip to main content

    URL Encoder / Decoder

    Encode text to URL-safe format or decode URL-encoded strings

    0 characters · 1 lines

    0 characters · 1 lines

    Why Use URL Encoding?

    URL encoding (percent encoding) is essential for web development because URLs can only safely contain a limited set of ASCII characters. This free online URL encoder converts special characters, spaces, and non-ASCII text into a format that can be transmitted over the internet without breaking URLs or causing server errors. Whether you're building query parameters, testing APIs, creating shareable links, or debugging web applications, proper URL encoding ensures your data arrives intact.

    Special characters like spaces, ampersands (&), question marks (?), equals signs (=), and international characters all require encoding in URLs. Our tool uses encodeURIComponent for maximum safety, encoding everything except alphanumeric characters and - _ . ~ . This is perfect for query parameter values, form data, and Base64 strings in URLs. Combine with Slugify for creating complete SEO-friendly URLs.

    Common Use Cases for URL Encoding

    🔗Query Parameters & API Requests

    Encode values for URL query parameters when calling REST APIs or building search URLs. Essential for search queries, filters, and any data passed via GET requests. For example, "name=John Doe&city=New York" must become "name=John%20Doe&city=New%20York". Critical for JavaScript fetch/axios requests, WordPress permalinks, and GET form submissions.

    🌐Shareable Links & Dynamic URLs

    Create shareable links that contain state, search terms, or user content. Essential for social media share buttons, email templates with UTM parameters, deep linking in mobile apps, and bookmarkable application states. Encode JSON data, user names, or complex filters into URL parameters for single-click sharing.

    🔍SEO & International URLs

    Handle international characters in URLs for multilingual websites. While modern browsers display Unicode URLs (e.g., "café"), they're actually encoded server-side (caf%C3%A9). Essential for international SEO, non-English content, and ensuring URLs work across all browsers and email clients. Use with Remove Diacritics for clean ASCII-only URLs.

    🛠️OAuth Redirects & Web Development

    Encode redirect URLs for OAuth flows, callback URLs, and authentication systems. When passing URLs as parameters (e.g., redirect_uri=https://example.com), the nested URL must be encoded. Essential for social login implementations, payment gateway returns, and any system where URLs are passed as URL parameters. Debug failed redirects by decoding to check formatting.

    How URL Encoding Works

    URL encoding replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's UTF-8 code. For example, a space (character code 32, or 0x20 in hex) becomes %20. The ampersand (&) becomes %26, question mark (?) becomes %3F, and international characters like é (UTF-8: 0xC3 0xA9) become %C3%A9. Only unreserved characters (A-Z, a-z, 0-9, hyphen, underscore, period, tilde) remain unencoded.

    This tool uses JavaScript's encodeURIComponent function, which encodes ALL special characters including those with special meaning in URLs (: / ? # [ ] @ ! $ & ' ( ) * + , ; =). This is safer than encodeURI for parameter values because it prevents characters from being misinterpreted as URL delimiters. For example, encoding "http://example.com?q=test" produces "http%3A%2F%2Fexample.com%3Fq%3Dtest".

    For decoding, the tool uses decodeURIComponent to convert percent-encoded characters back to their original form. All processing happens locally in your browser with a 300ms debounce for optimal performance—your data never leaves your device. If you need to encode full URLs while preserving their structure, consider using encodeURI instead, but for query parameter values and form data, encodeURIComponent (used by this tool) is the correct choice.

    Tips for Best Results

    • Encode values, not full URLs: Only encode the parameter VALUES, not the entire URL. "?search=hello world" should become "?search=hello%20world", not "%3Fsearch%3Dhello%20world".
    • Double encoding trap: Avoid encoding already-encoded strings. "hello%20world" re-encoded becomes "hello%2520world" (the % becomes %25), breaking URLs.
    • Base64 in URLs: When passing Base64-encoded data in URLs, always URL-encode it since Base64 uses +, /, and = characters.
    • Clean URLs for SEO: For blog posts and pages, create clean slugs instead of encoding. "my-blog-post" is better SEO than "My%20Blog%20Post".
    • Testing APIs: Use this tool to prepare query parameters for API testing tools like Postman, curl, or browser fetch requests.
    • Debugging 400 errors: Server 400 (Bad Request) errors often come from unencoded special characters. Decode server logs to identify problematic characters.

    Related Tools

    Frequently Asked Questions