Loading CSS Validator...
Please wait a moment

How to Validate CSS - Step by Step Guide

Step 1

Input Your CSS Code

Start with the CSS you want to check. A whole stylesheet or a single rule both work.

•
Paste CSS: Copy your CSS code and paste it into the validator
•
Upload file: Select a .css file from your computer
•
Try sample: Click "Sample" to test with example CSS
Step 2

Automatic Syntax Check

A moment after you stop typing, the validator reads your CSS the way a browser does and looks for syntax errors. Property names and values are not checked against the spec.

•
Structure: unclosed { blocks, stray }, unclosed strings, comments and url(), unbalanced brackets
•
Declarations: a missing colon, an empty value, or a missing semicolon before the next property
•
Location: every problem comes with its line and column
Step 3

Review Results & Fix Errors

Go through the list and fix each problem in the editor. If you're new to the syntax rules, web.dev's Learn CSS course explains them well.

•
Plain messages: each error says what is wrong, for example "color" has no colon after it
•
The line itself: shown under the message so you can spot it quickly
•
Valid CSS: a green badge once no syntax errors are left

Frequently Asked Questions

What does this CSS validator check?

It checks the structure of your stylesheet: every { has a matching }, strings, comments and url() are closed, brackets inside values are balanced, and each declaration has a property name, a colon and a value. It also flags a colon that shows up in the middle of a value, which almost always means the semicolon before the next property is missing. Every problem comes with its line and column.

Does it check property names and values?

No. A typo like colr: red or a value like width: banana passes, because the syntax is fine even though the browser will ignore it. For that kind of check, the W3C CSS Validation Service compares every property and value against the spec.

Will it complain about semicolons inside strings or data URLs?

No. Strings, comments, escapes and unquoted url(...) values are read as single pieces, the way a browser reads them, so content: "a;b}" or url(data:image/png;base64,...) don't trigger false errors. Custom properties can hold almost anything, including braces, and are left alone.

Does it understand modern CSS like nesting, @layer and calc()?

Yes, as far as syntax goes. Nested rules such as &:hover { } inside a block, @media, @supports, @layer, @container, @font-face, @keyframes, calc() and !important are all accepted. It doesn't check whether a particular browser supports a feature.

Can it fix the errors for me?

No, it only points at them. Each message says what is wrong and where, for example a { that is never closed or a missing colon, and shows the line so you can fix it in your editor. If you also want the file tidied up, the CSS Formatter on this site re-indents it without changing any values.

Is my CSS uploaded anywhere?

No. The check runs in your browser, and files you upload are read locally. Nothing is sent to a server, and nothing in your CSS is changed.