A CSS validator (or CSS checker) reads your stylesheet and points out the mistakes: a missing
semicolon, a misspelled property, a value that doesn’t make sense, a { that’s never closed. Paste
your CSS on the left and the list of problems shows up on the right, with the exact line and column for each one.
Why do you need one? Because CSS fails silently. When the browser hits something it doesn’t understand, it
doesn’t show an error. It just skips that declaration (or the whole rule, or everything after a missing brace)
and moves on. So you end up wondering why your padding “doesn’t work”, when the real problem is a missing
; on the line above. A validator finds that in a second. It checks your CSS against the CSS
specifications using the open-source css-tree
library, right here in your browser. Your code isn’t uploaded anywhere.
How to Use It – Step by Step
Four quick steps. Each one shows a common mistake and how to fix it. Paste the “before” code into the validator
and see what it says.
Step 1 Paste or Open Your CSS
Get some CSS into the editor on the left. Pick whichever is easiest:
Paste it: from your code editor, a theme, a <style> block or DevTools.
Open a file: click the upload button, or just drag your .css file onto the editor.
Click Sample: loads a small stylesheet with a few mistakes hidden in it. Can you fix them all?
There’s no Check button. The results update a moment after you stop typing, so you can fix something and watch
the problem disappear.
Step 2 Read the Results and Jump to Each Problem
Every problem shows a red error or amber warning badge, where it is (line and
column), what’s wrong in plain English, and a short rule name. Click a problem and the validator selects that
line in the editor. Start at the top: one missing semicolon or brace can confuse everything after it.
Example: the classic missing semicolon
❌ Before:
.header{padding: 12px 24px
background: #6f4e37;}
✅ After:
.header{padding: 12px 24px;background: #6f4e37;}
The validator says: “A ; is missing after “padding: 12px 24px”. Without it, the next line becomes part of this value.” The browser reads 12px 24px background: #6f4e37 as one
(invalid) padding value and throws both lines away.
Step 3 Fix Typos in Properties and Values
Every property and value is checked against the CSS specs. A misspelled property is simply ignored by the
browser, and so is a value with a wrong unit. These show up as warnings, and for property typos you even get a
“did you mean” hint.
Example: a typo in a property and in a unit
❌ Before:
.card{colr: #333;border-radius: 8pz;}
✅ After:
.card{color: #333;border-radius: 8px;}
The validator says: “Unknown property “colr”. Did you mean “color”?” and ““8pz” isn’t a valid value for border-radius. Check for a typo or a wrong unit.”
Example: calc() needs spaces around + and -
❌ Before:
.sidebar{width: calc(100% -240px);}
✅ After:
.sidebar{width: calc(100% - 240px);}
💡 This one trips up everybody. -240px without a space is read as a negative number, so the browser
sees two numbers with nothing in between and ignores the width. The validator says: “In calc(), + and - need a space on both sides. Write “a + b” or “a - b”, not “a +b” or “a-b”.”
Step 4 Check Your Braces
A missing } is the nastiest CSS bug: everything after it ends up inside the wrong block, so
rules far below stop working or only work on small screens. The validator tells you which { was
never closed, so you know where to look.
Example: a media query that’s never closed
❌ Before:
@media (max-width: 600px) {.nav{display: none;}/* the } for @media is missing */.footer{padding: 24px;}
The validator says: “The { on line 1 is never closed. Add a } where this block should end.” Without the fix, .footer only gets its padding on
screens up to 600px wide.
Copy report: copies the list of problems as plain text, handy for a code review or a ticket.
Not exactly. This tool checks your CSS against the CSS specifications too (using the open-source css-tree library and MDN’s data), but it runs in your browser and updates as you type. It also catches things the W3C validator doesn’t explain well, like a missing semicolon or calc() without spaces. For a formal check before a big launch, you can still run the W3C CSS Validation Service as well.
What’s the difference between errors and warnings?
Errors break your CSS: a missing }, a missing semicolon, an unclosed string or comment, or calc(100% -10px). The browser throws away the broken part, and sometimes everything after it. Warnings are things the browser will ignore or that are probably mistakes: a misspelled property, a value that doesn’t fit, an empty rule or a property set twice. Fix the errors first.
Why does it say a property I use is unknown?
Usually it’s a typo, and the message suggests the right name. If you’re sure the property is real, it may be very new, experimental or browser-specific, and not in the spec data yet. That’s why unknown properties are warnings, not errors: check the name on MDN and ignore the warning if it’s right.
Does it check values that use var()?
No. A value like color: var(--brand) can only be checked once the browser knows what --brand is, so values with var(), env() or attr() are skipped. The custom properties themselves (--brand: #6f4e37) can hold almost anything, so they’re skipped too.
Does it support modern CSS?
Yes: nesting, @layer, @container, @property, :has(), color functions like oklch() and color-mix(), and the newer layout properties are all understood. If something brand new shows up as a warning, it’s probably just newer than the data.
Can it check the CSS inside my HTML file?
Paste just the CSS, without the <style> tags. If you want to check the HTML itself (unclosed tags, duplicate ids, missing alt text), use the HTML Validator.
Is my CSS uploaded anywhere?
No. Every check runs right here in your browser, so your code never leaves your computer.