%2F is the URL-encoded slash (/).
In a URL, %2F stands for the slash (/). Here is when to encode it, what it does in each part of a URL, and what every major language outputs.
Quick facts
| Character | / |
|---|---|
| Name | Slash (forward slash) |
| Unicode | U+002F |
| UTF-8 bytes | 2F (1 byte) |
| Percent-encoded | %2F |
| Lowercase form | %2f — identical meaning |
| Double-encoded | %252F |
| HTML form encoding | %2F |
| RFC 3986 class | Reserved — general delimiter |
What it means in a URL
The slash separates path segments. A slash that is part of the data — a file name, a date like 10/31, a nested URL — must be encoded as %2F. Python’s quote() keeps slashes by default; pass safe="" for a single value.
RFC 3986 class: Reserved — general delimiter. It marks the structure of a URL (scheme, authority, path, query, fragment), so as data it must be encoded.
When to encode it
| Where it appears | What to do |
|---|---|
| Path segment | Encode if it is data (a raw / starts a new segment) |
| Query value | Allowed raw (encoding is also fine) |
| Fragment | Allowed raw |
| Form body | Encode |
The mistake to watch for
Servers that decode %2F back to / before routing (Apache needs AllowEncodedSlashes), turning one segment into two and causing 404s.
What each language produces
Left as-is by JavaScript encodeURI(s), Python urllib.parse.quote(s); every other function in the table encodes it. Output for the single character, UTF-8 input, tested against the real runtimes (see the encoding comparator for your own strings).
| Function | Output | |
|---|---|---|
| JavaScript encodeURIComponent(s) | %2F | encoded |
| JavaScript encodeURI(s) | / | kept |
| JavaScript URLSearchParams | %2F | encoded |
| Python urllib.parse.quote(s) | / | kept |
| Python quote(s, safe="") | %2F | encoded |
| Python urllib.parse.quote_plus(s) | %2F | encoded |
| PHP rawurlencode($s) | %2F | encoded |
| PHP urlencode($s) | %2F | encoded |
| Java URLEncoder.encode(s, UTF_8) | %2F | encoded |
| Go url.QueryEscape(s) | %2F | encoded |
| Go url.PathEscape(s) | %2F | encoded |
| Ruby URI.encode_www_form_component(s) | %2F | encoded |
| Ruby ERB::Util.url_encode(s) | %2F | encoded |
| C# / .NET Uri.EscapeDataString(s) | %2F | encoded |
Decoding it
decodeURIComponent('%2F') returns the slash (/). Python: urllib.parse.unquote('%2F'); PHP: rawurldecode('%2F'). Paste any string into the URL decoder to decode it in your browser.
Common questions.
%2F is the percent-encoded form of the slash (/), whose byte value is 0x2F. Decoding the URL turns it back into the character.
Yes. Hex digits in percent-encoding are case-insensitive, so %2f and %2F mean the same thing. RFC 3986 recommends uppercase, and mixing cases can make caches and analytics count one URL as two.
Use your language’s encoder on the value: encodeURIComponent in JavaScript gives %2F, Python’s quote(s, safe="") gives %2F, PHP’s rawurlencode gives %2F.
More from the toolkit.
About this page. Written and maintained by Sri Murugan Systems, the developer of urlencodedecode.com. Character classes follow RFC 3986 §2; language outputs were generated by running each function in its real runtime.