CSS Validator and Syntax Checker
WM-93Paste CSS and find its syntax mistakes, each with a line and column. It also warns about property names it does not recognize.
Runs in your browser. Nothing is uploaded.
CSS
Result
How to use it
- Paste your CSS, or open a .css file or drop it on the input box.
- Choose how many problems to list, and whether to warn about unknown property names.
- Press Validate.
- Fix the problems listed, or use Go to error to jump to the first one.
What it checks
It looks for unclosed comments, strings, parentheses and braces, closing brackets with nothing to close, empty selectors, a selector followed by a stray comma, a declaration without a colon or without a value, a missing semicolon before the next property, and !important written wrongly. When the syntax is clean it counts rules and declarations and lists warnings for unknown properties and at-rules.
What it does not check
This is a syntax checker, not the W3C validator. It does not know which values are valid for a property, so color: banana passes, and it does not check selectors against any HTML. Vendor prefixes and custom properties starting with -- are not warned about. A custom property whose value contains curly braces is reported as an error, even though some browsers accept it.
Reading the report
Problems are listed in the order they appear, each with its line and column, up to the number you choose. The Go to error button moves the cursor to the first problem. Warnings do not stop the result from saying the syntax is valid, since an unknown property may simply be new.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
1 problem found. Line 1, column 6: "color red" is not a declaration: there is no : between the property and its value | A declaration is missing its colon. | Add : between the property name and the value. |
1 problem found. Line 1, column 4: this { is never closed (missing }) | A block was opened but never closed. | Add } where the rule should end. |
Questions people ask
How do I check my CSS for errors?
Paste the CSS and press Validate. Every syntax problem is listed with its line and column, so you can fix the first and re-check. Every syntax problem is listed with its line and column, so you can fix the first one and check again. Use Go to error to jump straight to it.
Is this the same as the W3C CSS validator?
No. It checks syntax only and does not judge values against the specification. A value that is wrong for its property is not flagged. No. It checks syntax only and does not judge values against the specification. A value that is wrong for its property is not flagged.
Why does it warn about a property that works?
The warning means the name is not in this page's list of known properties. New or experimental properties can trigger it. Untick the warning option to hide them.
Does it handle SCSS or LESS?
No. Nested rules and variables from those languages are not valid plain CSS and may be flagged. Use a formatter for those languages. No. Nested rules and variables from those languages are not valid plain CSS and may be flagged. Use a formatter built for those languages instead.
Does it check media queries and at-rules?
It checks brackets and structure inside them, and warns about at-rules it does not know. It does not check the conditions in a media query.
About this tool
A syntax checker, not the W3C validator. It finds unclosed comments, strings, brackets and url( values, mismatched closers, empty selectors, declarations with no colon or value, a missing semicolon before the next property, and misspelled !important. It then lists unknown property names and at-rules as warnings; vendor-prefixed and custom properties are not warned about. It does not check that values are valid for their property, so color: banana passes. A custom property whose value holds curly braces is reported as an error. Nothing is sent to a server.