%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/
NameSlash (forward slash)
UnicodeU+002F
UTF-8 bytes2F (1 byte)
Percent-encoded%2F
Lowercase form%2f — identical meaning
Double-encoded%252F
HTML form encoding%2F
RFC 3986 classReserved — 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 appearsWhat to do
Path segmentEncode if it is data (a raw / starts a new segment)
Query valueAllowed raw (encoding is also fine)
FragmentAllowed raw
Form bodyEncode

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).

FunctionOutput
JavaScript encodeURIComponent(s)%2Fencoded
JavaScript encodeURI(s)/kept
JavaScript URLSearchParams%2Fencoded
Python urllib.parse.quote(s)/kept
Python quote(s, safe="")%2Fencoded
Python urllib.parse.quote_plus(s)%2Fencoded
PHP rawurlencode($s)%2Fencoded
PHP urlencode($s)%2Fencoded
Java URLEncoder.encode(s, UTF_8)%2Fencoded
Go url.QueryEscape(s)%2Fencoded
Go url.PathEscape(s)%2Fencoded
Ruby URI.encode_www_form_component(s)%2Fencoded
Ruby ERB::Util.url_encode(s)%2Fencoded
C# / .NET Uri.EscapeDataString(s)%2Fencoded

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.

← %2E Period (dot)  ·  Full URL encoding table  ·  %3A Colon →

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.