FormatterHQ

CSS Validator

Check a stylesheet for syntax errors, misspelled properties and invalid values. Each problem is listed with its line and column.

Input CSS
Output TEXT
Ready.

How to use the CSS Validator

  1. Paste your CSS into the Input editor, or use Sample, Upload file or Load URL to check a live stylesheet.
  2. Press Validate (it re-runs automatically while Auto update is on).
  3. Read the report: syntax errors stop validation and show a line and column; otherwise each unknown property or invalid value is listed with its position.
  4. Fix the listed lines and validate again. Copy or Download saves the report.

How this CSS validator works

This CSS validator checks your stylesheet in two passes. First it parses the file with PostCSS, which finds syntax errors: unclosed blocks, stray braces, unclosed strings or comments. If the syntax is valid, a second pass uses the CSS grammar data from the csso project to check each declaration: is the property known, and does the value match what the specification allows for it? The report lists every problem with its line and column, plus the number of rules and declarations checked.

Example

.card{colr:red;display:flexbox;margin:10px 5px 3px 2px 1px;--brand:#0f766e;-webkit-box-flex:1;width:calc(100% - 20px)}
Syntax is valid, but 3 problem(s) were found:

Line 1, column 7: Unknown property "colr"
Line 1, column 16: Invalid value for "display": flexbox
Line 1, column 32: Invalid value for "margin": 10px 5px 3px 2px 1px

Rules: 1
Declarations: 6

colr is a typo. flexbox is not a valid display keyword (you want flex). margin accepts one to four values, not five. The custom property, the vendor-prefixed -webkit-box-flex and the calc() width pass.

Why invalid CSS is a silent problem

Browsers are designed to be forgiving with CSS: when a declaration is invalid, it is simply ignored, and the rest of the rule still applies. That is good for users but bad for debugging, because nothing tells you that display: flexbox did nothing. A syntax error is worse: a missing } can make the browser treat the following rules as part of the broken block, so styles far away from the mistake stop working. A validator catches both before they reach production.

What is checked

  • Syntax: balanced braces, closed strings and comments, well-formed at-rules, and no stray characters. Syntax errors are reported first and stop the check.
  • Unknown properties: misspellings and properties that do not exist in any CSS specification.
  • Invalid values: wrong keywords, wrong number of values, invalid units or colors.

Some declarations are deliberately skipped because they cannot be checked against the standard grammar: custom properties (--name), vendor-prefixed properties (-webkit-, -moz-), and old IE hacks such as *zoom and _height.

Common errors and fixes

ReportTypical fix
Unclosed blockAdd the missing }; the position points to where the unclosed block starts
Unexpected }Remove an extra closing brace
Unknown property "text-colour"Use US spelling: color, text-decoration-color
Invalid value for "width": 100Add a unit: 100px. Only 0 may be unitless for lengths
Invalid value for "color": #gggHex colors use 0–9 and a–f, with 3, 4, 6 or 8 digits

Limits of automated validation

The property and value data covers the CSS specifications broadly, but very new features can arrive in browsers before validator data catches up, so a recently shipped property may be reported as unknown even though your target browsers support it. At present that affects oklch() and color-mix() colors and the container-type and text-wrap properties. Declarations inside nested rules (CSS nesting) are not checked at all, so a typo there is not reported. Also, "valid" does not mean "supported everywhere": check browser support tables for newer features. SCSS and LESS syntax such as $variables or mixins is not plain CSS; compile it first with the SCSS Compiler and validate the output.

After validating, make the file readable with the CSS Formatter or smaller with the CSS Minifier. Validation runs in your browser; your stylesheet is not uploaded.

Frequently asked questions

Is this the same as the W3C CSS Validator?
No, it is an independent validator that runs in your browser. It checks syntax with PostCSS and property values against CSS grammar data from the csso project. Results are similar for common errors but can differ for very new features.
Why is a new CSS property reported as unknown?
Validator data can lag behind browser releases. If you know the property is supported by your target browsers, you can safely ignore the warning.
Are vendor prefixes and custom properties checked?
They are skipped on purpose. Vendor-prefixed properties and custom properties have no fixed grammar to check against, so they never produce warnings.
Can I validate SCSS or LESS?
Not directly. Preprocessor syntax is not CSS. Compile it with the SCSS or LESS compiler first, then validate the resulting CSS.
Why does one missing brace break so many rules?
CSS parsers treat everything after an unclosed block as part of that block, so following rules are misread. The validator reports where the unclosed block starts so you can fix it at the source.

Last updated October 3, 2026

Related tools

Credit Card Validator Check credit card numbers with the Luhn algorithm, detect Visa, Mastercard, Amex and more, and verify length. Runs 100% locally. Email Address Validator Check email address syntax in bulk and flag typos in popular domains, disposable providers, role accounts and duplicates. HTML Validator Validate HTML markup online and find unclosed, mismatched or malformed tags. IBAN Validator Validate IBANs for 80+ countries with the MOD-97 checksum and country length rules, and see bank code and account parts. ISBN Validator & Converter Validate ISBN-10 and ISBN-13 check digits and convert between the two formats, one or many at a time. JavaScript Validator Check JavaScript for syntax errors online and find the exact line and column of each problem. Phone Number Validator & Formatter Validate phone numbers for 240+ regions and format them as E.164, international and national, with line type detection. TOML Validator Validate TOML files online against the TOML 1.0 spec. Find syntax errors by line and column and see the parsed data as JSON. UUID Validator & Decoder Validate UUIDs/GUIDs and decode version, variant and embedded timestamps for v1, v6 and v7 — many at once. Bcrypt Hash Checker Check whether a password matches a bcrypt hash, like PHP password_verify, entirely in your browser. CMYK to HEX Converter Convert CMYK colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. Color Contrast Checker (WCAG) Check the WCAG 2 contrast ratio of text and background colours for AA and AAA, preview it live and get the closest passing colour.