Backslash HTML entity \

\ is the HTML entity for Backslash \ (U+005C). Copy the decimal \ and hex \ codes plus CSS, JavaScript, Python and URL escapes.

Entity
\
Code point
U+005C
Unicode name
REVERSE SOLIDUS
Block
Basic Latin
Category
Other punctuation (Po)
Since
Unicode 1.1
Defined in
HTML5

Codes to copy

HTML named\Works in HTML; in XML only & < > " ' are predefined.
HTML decimal\Works in HTML and XML.
HTML hex\Works in HTML and XML.
CSScontent: "\5C";In a stylesheet, for ::before and ::after.
JavaScript"\u005C"Also valid in JSON.
Python"\u005c"Python 3 string literal.
Python by name"\N{REVERSE SOLIDUS}"Readable alternative using the Unicode name.
URL%5CPercent-encoded UTF-8 bytes, for a path or query value.
UTF-8 bytes5C1 byte.
UTF-16005C1 code unit, which is what JavaScript length counts.

When to use it

The backslash. HTML treats it as plain text, but it is the escape character in JavaScript, JSON, CSS and regular expressions, so code samples often need it doubled.

The name comes from the HTML5 list (much of it shared with MathML), so it works in every current browser but not in XML or XHTML served as XML, where the numeric reference is the safe choice.

More html syntax and ascii punctuation

All html syntax and ascii punctuation · Every HTML entity · Encode or decode text

Source: the WHATWG HTML Standard list of named character references and the Unicode Character Database (Unicode 18.0).