Encode special characters for URLs or decode percent-encoded strings. Runs entirely in your browser.
| Character | Encoded | Description |
|---|---|---|
| (space) | %20 | Space character |
| ! | %21 | Exclamation mark |
| # | %23 | Hash / fragment identifier |
| $ | %24 | Dollar sign |
| & | %26 | Ampersand / query separator |
| ' | %27 | Apostrophe / single quote |
| ( | %28 | Opening parenthesis |
| ) | %29 | Closing parenthesis |
| + | %2B | Plus sign |
| , | %2C | Comma |
| / | %2F | Forward slash / path separator |
| : | %3A | Colon |
| ; | %3B | Semicolon |
| = | %3D | Equals sign |
| ? | %3F | Question mark / query start |
| @ | %40 | At sign |
| [ | %5B | Opening bracket |
| ] | %5D | Closing bracket |
| % | %25 | Percent sign |
encodeURIComponent (default) for encoding individual query parameters or values. Use encodeURI when you want to encode a full URL while preserving structural characters like :, /, ?, and #.URL encoding, also known as percent-encoding, is a mechanism defined in RFC 3986 for representing characters in a Uniform Resource Identifier (URI) that are not allowed or have special meaning. It replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII or UTF-8 byte value.
For example, a space character is encoded as %20, and an ampersand (&) is encoded as %26. This ensures that URLs remain valid and unambiguous when transmitted over the Internet, since characters like &, =, and ? have special structural meaning in a URL.
encodeURIComponent() encodes nearly all special characters, including :, /, ?, #, &, and =. It is designed for encoding a single URI component such as a query parameter value.
encodeURI() encodes only characters that are not valid in a complete URI. It preserves structural delimiters like ://, /, ?, #, and &, making it suitable for encoding an entire URL while keeping its structure intact.
Although both URL encoding and HTML encoding convert special characters into safe representations, they serve different purposes and use different syntax:
| Feature | URL Encoding | HTML Encoding |
|---|---|---|
| Purpose | Make characters safe for use in URLs | Make characters safe for display in HTML |
| Syntax | % + hex value (e.g., %26) |
& + entity name or number (e.g., &) |
| Space | %20 or + |
No special encoding needed |
| Ampersand | %26 |
& |
| Used in | URLs, query strings, API requests | HTML documents, web page content |
| Standard | RFC 3986 | HTML specification (W3C) |
In practice, you use URL encoding when building or parsing URLs, and HTML encoding when inserting dynamic text into an HTML page to prevent XSS attacks and rendering issues.
The table below lists frequently encoded characters, their percent-encoded equivalents, and their typical role in URLs. Bookmark this page as a quick reference when working with URLs.
| Character | Encoded | Role in URLs |
|---|---|---|
(space) | %20 | Separates words; not allowed in URLs |
% | %25 | Marks the start of a percent-encoded sequence |
& | %26 | Separates query parameters (?a=1&b=2) |
= | %3D | Separates key from value in query params |
? | %3F | Starts the query string |
# | %23 | Fragment identifier (anchor link) |
/ | %2F | Path separator |
: | %3A | Scheme separator (https:), port |
@ | %40 | User info separator (user@host) |
+ | %2B | Sometimes represents a space in form data |
" | %22 | Double quote |
< | %3C | Less than sign |
> | %3E | Greater than sign |
{ | %7B | Opening brace |
} | %7D | Closing brace |
| | %7C | Pipe / vertical bar |
encodeURI() encodes a complete URI and preserves characters that have structural meaning in URLs, such as :, /, ?, #, and &. Use it when you have a full URL and want to make it safe without breaking its structure.encodeURIComponent() encodes everything except letters, digits, and a handful of unreserved characters (- _ . ! ~ * ' ( )). Use it when encoding a single value that will be embedded inside a URL, such as a query parameter value or a path segment.
encodeURIComponent(), decodeURIComponent(), encodeURI(), and decodeURI() functions. No data is transmitted to any server. You can verify this by disconnecting from the Internet and using the tool offline.
application/x-www-form-urlencoded format (used by HTML form submissions), spaces are encoded as +. In standard percent-encoding defined by RFC 3986, spaces are encoded as %20. JavaScript's encodeURIComponent() always uses %20. This tool uses the standard RFC 3986 percent-encoding, so spaces are always represented as %20.
%F0%9F%98%8A, and the letter é becomes %C3%A9. This tool fully supports encoding and decoding of any Unicode text.
://, /, ?, =, and & intact./, ?, and &.