URL Encoder & Decoder

Percent-encode special characters in URLs and query strings, or decode encoded URLs back to human-readable text. Instant, in-browser, free.

Common URL-Encoded Characters

Character Encoded Description

URL Encoding Explained

URL encoding (also called percent-encoding) is a mechanism for representing characters in a Uniform Resource Identifier (URI) using only the ASCII character set. The specification is defined in RFC 3986. Characters that have special meaning in URLs (such as &, =, ?, and #) or that are not in the ASCII set (such as Unicode characters, spaces, and accented letters) must be encoded before being included in a URL.

Encoding works by replacing the unsafe character with a percent sign (%) followed by the character's two-digit hexadecimal ASCII code. A space character (ASCII 32, hex 20) becomes %20. The ampersand & (ASCII 38, hex 26) becomes %26.

encodeURI vs. encodeURIComponent

JavaScript provides two built-in functions with an important distinction:

Query String Encoding

When building a URL query string manually, every parameter value must be URL-encoded. Consider the URL https://example.com/search?q=HTML editor online&lang=en. The space in the query value is invalid. Encoded correctly: https://example.com/search?q=HTML%20editor%20online&lang=en. Most HTTP client libraries handle this automatically, but when constructing URLs by string concatenation it is critical to encode values explicitly. If your URLs contain HTML attributes that also need escaping, use our HTML Entities encoder alongside this tool. For building SEO-optimised meta tags with correctly encoded canonical URLs, try our meta tag generator.

Frequently Asked Questions

Both represent a space, but in different contexts. %20 is the standard percent-encoding of a space per RFC 3986 and is correct in any part of a URL. The + character represents a space only in application/x-www-form-urlencoded content (HTML form submissions). Using + in path segments is incorrect. When decoding, always replace + with a space before calling decodeURIComponent().

URLs can only contain a limited set of ASCII characters. Characters outside that set — including spaces, non-ASCII Unicode, and characters with special URL meaning — will be misinterpreted or cause the URL to be invalid. For example, a space in a URL may be truncated by some browsers or servers, and an unencoded & in a query value will be parsed as a parameter separator rather than a literal ampersand.

PHP provides urlencode() for encoding query string values (encodes spaces as +), rawurlencode() for RFC 3986 encoding (encodes spaces as %20), and http_build_query($array) for building a complete query string from an array. Use rawurlencode() for path segments and urlencode() for query parameter values when using traditional form-encoded content.

No. URL encoding (percent-encoding) replaces unsafe characters with their hex representation and is specifically designed for use within URLs. Base64 encodes arbitrary binary data as a string of 64 printable ASCII characters and is used for transmitting binary content (like images or files) in text contexts. A Base64 string contains +, /, and = characters which would themselves need URL encoding if included in a URL.