sanitize.css is a CSS library that provides consistent, cross-browser default styling of HTML elements alongside useful defaults.
The tool solves the problem of inconsistent browser rendering and missing sensible defaults for HTML elements. It normalizes styles across browsers while also applying opinionated improvements that align with common developer expectations rather than strict CSS specifications. The library wraps all styles in zero-specificity selectors using :where(), which means the rules can be easily overridden without requiring high specificity in your own stylesheets. sanitize.css is developed in parallel with normalize.css, ensuring every normalization is included while clearly marking which rules are normalizations versus opinions.
Developers should choose sanitize.css over normalize.css if they prefer opinionated defaults that go beyond specification compliance—such as border-box sizing, comfortable line heights, and sensible cursor behavior. The tool suits projects where you want a foundation that handles common styling concerns out of the box rather than starting from a minimal baseline. The project provides modular stylesheets for specific concerns: a forms stylesheet for normalizing form controls, a typography stylesheet using system interface fonts, an assets stylesheet for document measure, a reduce-motion stylesheet for accessibility, and separate stylesheets for system-ui and ui-monospace font support. Unlike reset.css, which removes all styling, sanitize.css maintains browser normalizations while adding developer-friendly defaults.
The project maintains active synchronization with normalize.css to ensure normalizations stay current. Development includes detailed inline documentation explaining what each rule does and why. The tool supports a wide range of browsers including recent versions of Chrome, Edge, Firefox, Safari, and Opera, as well as Internet Explorer 9 and later.