Back to Tools

CSS Escape Tool

CSS Escape Tool

Escape special characters in CSS selectors and property values for safe usage

CSS PRO
Raw String / Selector
Escaped Result

                

About the CSS Escape Tool

Escape special characters so they are safe to use in CSS selectors.

How to use the CSS Escape Tool

  1. Paste your code into the input box, or click Sample to load an example.
  2. Choose the Escape Mode: CSS Selector (for JS querySelector) or CSS Identifier (for Stylesheet).
  3. Press Escape CSS String.
  4. Use Copy (or Download where shown) to keep the result. Clear empties the box.

Worked example

.my-class#123 needs the characters escaped so that it is a valid selector.

Tips

  • Identifiers cannot start with a digit unless the digit is escaped.

Frequently Asked Questions

Characters such as #, ., : and digits at the start have special meanings in selectors.
Live Support
We usually reply within minutes

Enter your name to start a conversation with our team.