Skip to content
🩺

CSS Validator

Check a stylesheet for syntax errors, unknown properties, duplicate declarations and other problems that browsers silently ignore.

Runs in your browser

Updated

Errors

0

Warnings

0

Suggestions

0

This validator reads a small hand-checked list of standard properties, so it catches misspellings rather than enforcing the full specification. A clean result is not a guarantee that every browser will accept the file. Custom properties (--my-var) and unknown at-rules are reported as warnings, not errors.

A local parse with three severity levels

The stylesheet is parsed in the browser into rules and at-rules, with strings, comments and url() tokens kept intact so a semicolon inside a value cannot confuse the scanner. Findings are graded as errors, warnings or suggestions, and the three counters update as the text changes, roughly 200 milliseconds after typing stops. Nothing is uploaded.

A worked example

A 176 character sheet containing a border-radius declaration with no colon, a misspelt colr, padding set twice and a margin of 0px reports one error, two warnings and one suggestion. The missing colon appears as line 7, the line it occupies. The misspelling, the duplicate and the zero-with-unit are all reported at line 1, because issues found inside a rule carry the line where that rule starts. The banner reads "1 error — the browser will ignore part of this CSS."

What it looks for

  • Errors: unclosed blocks, strings, comments or url(), empty selectors, a declaration with no colon or no value.
  • Warnings: properties outside the built-in list, the same property set twice, unknown at-rules, !important in a selector.
  • Suggestions: a zero written with a unit, such as 0px or 0rem.

Where it stops

  • The property list matches names as written, so hyphenated properties such as font-size and line-height can be reported as unknown.
  • No value-level validation: display: red passes without comment.
  • A stray declaration outside any block can pass silently.
  • Vendor prefixes and newer at-rules may be flagged, and suggestions can be hidden.

Questions people ask

Does a clean report mean the CSS is correct?

No. It means the file parsed and nothing on the built-in lists matched. A browser can still drop a rule for an invalid value, an unsupported unit or a selector it cannot parse. The page itself says as much beneath the results.

How can indentation be fixed while hunting for errors?

Reformat with the CSS beautifier and re-validate. When two selectors appear to fight over the same element, the CSS specificity checker shows which one wins.