CSS Validator
Validate CSS syntax with a real parser — every error with a line number, and url(//…), strings, and multi-line values handled correctly.
Valid CSS: 0 rules, 0 declarations.
Valid CSS — 0 rules, 0 declarations
Stats
CSS Validator
This validator parses your CSS with css-tree— the same parser that powers the csso optimizer — so it understands real CSS syntax: protocol-relative URLs like url(//cdn/a.png), string values, and multi-line declarations are handled correctly (a line-based checker wrongly treats // as a comment and flags valid rules). It reports every syntax error with a line number and counts rules and declarations. For full W3C spec validation (property/value checking), use the official W3C CSS Validator. All processing runs entirely in your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Finding an unbalanced brace that is silently killing every rule after it.
- Checking a hand-edited stylesheet before deploying it.
- Spotting a missing colon in a declaration.
- Reviewing generated CSS after a build change.
- Getting a line number for a rule the browser is ignoring.
Frequently Asked Questions
- What does CSS do with a rule it cannot parse?
- Discards that declaration and continues — CSS has no error state. A misspelled property or an invalid value simply does not apply, which is why a typo produces no message anywhere and the only symptom is a style that did not take effect.
- How does error recovery work at the block level?
- An invalid selector invalidates the whole rule block, not just that selector — so one unrecognised selector in a comma-separated list silently kills the styles for all of them. That is the difference between a bad declaration and a bad selector, and it is why the second is worse.
- Is a vendor prefix an error?
- No — an unknown property is discarded by definition, which is exactly the mechanism prefixes rely on. That same forgiveness is what lets you write a modern value with an older fallback above it: the browser keeps whichever it understands and ignores the rest.
- Why does my rule not apply even though it validates?
- Usually specificity or order rather than syntax. A valid rule loses to a more specific one, or to an equally specific one later in the document. Validation only tells you the CSS is parseable — the cascade decides which parseable rule wins.
- Does a missing semicolon break everything after it?
- It breaks the declaration it belongs to and the one following, because the parser reads them as a single malformed declaration. The rest of the block recovers. The last declaration in a block is the one where the semicolon is genuinely optional.
Common errors and gotchas
- Assuming valid syntax means working styles, since specificity and order decide what applies.
- Treating an unknown property as an error, when browsers ignore it silently and so does CSS.
- Overlooking that one bad declaration is dropped while the rest of the rule still applies.
- Missing a stray brace, which can silently disable everything below it.
- Validating source that a build step will transform before it reaches a browser.