🔗 URL Encode & Decode
Percent-encode text for URLs or decode encoded URLs back to plain text. Runs entirely in your browser.
What is URL Encoding (Percent-Encoding) and When Do You Need It?
URL encoding, also known as percent-encoding, is a method of converting characters that aren't allowed in a URL into a safe format using a % sign followed by two hexadecimal digits. This is defined in RFC 3986 and is essential for properly constructing URLs with special characters, spaces, or non-ASCII text.
Characters That Must Be URL-Encoded
- Spaces →
%20(or+in query strings) - & →
%26— separates query parameters, so literal ampersands must be encoded - = →
%3D— separates key-value pairs in query strings - ? →
%3F— marks the start of query parameters - # →
%23— marks fragment identifiers - Non-ASCII characters (é, ñ, 日本語) → UTF-8 bytes percent-encoded
Common Developer Scenarios for URL Encoding
- Building API query strings programmatically — Ensure parameter values with special characters don't break the URL structure
- Encoding redirect URLs in OAuth flows — Callback URLs must be percent-encoded when passed as query parameters
- Debugging encoded URLs from server logs — Decode
%20,%3A, and other sequences to read URLs from access logs - Passing file paths in REST API endpoints — Encode slashes and spaces in file names when constructing API URLs
- Encoding user input for safe URL construction — Prevent injection attacks by encoding form values before adding them to URLs
URL Encoding vs HTML Entity Encoding — What's the Difference?
URL encoding (%26) is used in URLs and query strings. HTML entity encoding (&) is used in HTML documents. They serve different purposes: URL encoding ensures URL validity, while HTML encoding prevents XSS and ensures correct rendering in browsers. Use the right encoding for the right context.
How This URL Encoder/Decoder Works
This tool uses JavaScript's built-in encodeURIComponent() and decodeURIComponent() functions, which follow the RFC 3986 standard. Toggle between Encode and Decode mode, paste your text, and press Ctrl+Enter or click the button. Use the Swap feature to quickly decode an encoded URL and re-encode it.