Favorites

Updated CSS Validator - Complete Makeover, New Engine

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
CSS Validator Updated

If you've ever pasted a perfectly valid stylesheet into an online CSS validator, only to be bombarded with false errors about oklch(), dvh units or custom properties, you'll know how frustrating outdated tooling can be. That problem just got a whole lot smaller.

The CSS Validator at CSS Portal has been completely rebuilt from the ground up, with a brand new validation engine: one that actually understands CSS as it's written in 2026.

Why a new engine?

The most widely used CSS validators on the web, including CSSLint, haven't kept pace with the language. CSSLint hasn't been meaningfully updated in years, and the W3C validator, while authoritative, often lags behind newer specifications. The result? Tools that flag modern, perfectly valid CSS as broken.

The new CSS Portal validator takes a different approach: it was designed from scratch to support contemporary CSS first, rather than treating newer features as edge cases.

Modern CSS is a first-class citizen

The validator now fully recognises and correctly handles the CSS features that have become standard practice:

  • Custom properties (--my-variable) are tracked across declarations and usages.
  • Modern colour functions, including oklch(), color-mix(), and the full range of hsl() and rgb() syntaxes.
  • Viewport units such as dvh, dvw, svh and svw, with no more false errors on responsive layouts.
  • At-rules, including @layer, @container, @supports and @keyframes, are all validated structurally and semantically.
  • color-scheme and other modern properties are recognised without issue.

In other words, a stylesheet like this one gets a clean bill of health:

@layer base, components;

:root {
  color-scheme: light dark;
  --brand: oklch(55% 0.2 260);
}

@layer components {
  .hero {
    min-height: 100dvh;
    background: color-mix(in oklch, var(--brand), white 20%);
  }

  @container (min-width: 40rem) {
    .card {
      display: grid;
      grid-template-columns: 1fr 2fr;
    }
  }
}

If your CSS is valid, the validator won't tell you otherwise.

Three severity levels, not just pass or fail

Every issue is classified into one of three clearly separated categories:

LevelWhat it meansExamples
ErrorsGenuine problems that will stop your CSS from workingUnknown properties, invalid values, missing braces, malformed calc() expressions, invalid selectors
WarningsThings that won't necessarily break your CSS today, but are worth revisitingObsolete vendor prefixes, deprecated properties, missing unprefixed versions, use of undeclared variables
InfoPurely advisory: your CSS is valid, but there's something worth knowingAn unnecessary unit on a zero value, use of !important, duplicate selectors, unquoted font family names

This tiered approach means you can focus your attention where it actually matters.

Smarter checks

Intelligent shorthand validation

Shorthand properties such as border, background, transition, font and animation are notoriously difficult to validate, because their values combine several types in a flexible order. The new engine carefully splits shorthand values into separate parts, treating CSS functions like linear-gradient() and rgb() as single units, before checking each part against the right rules.

Crucially, animation names are treated as valid names. So animation: fade 1s ease won't produce a false error just because fade is defined in a separate file.

Selector validation that actually makes sense

The validator checks selectors for real mistakes: invalid combinator characters, two combinators in a row, selectors that begin or end with a combinator, and class or ID names that start with a number. Escaped characters are correctly recognised and allowed through without triggering false errors.

Structural error detection

Missing opening and closing braces are detected and reported with accurate line numbers. Importantly, checking continues past structural errors where possible, so a single missing brace won't hide every other error in the file.

Missing semicolons are caught too, including the subtle case where a missing semicolon causes the next property name to be read as part of the previous value:

.button {
  color: white       /* missing semicolon */
  background: navy;  /* read as part of the color value */
}

The error message in that case is targeted and readable, not confusing.

Summary statistics

Every validation run now produces a statistics panel alongside the list of issues. You'll see:

  • the total number of rules and declarations
  • the five most-used properties
  • the CSS variables declared and used
  • the at-rules present
  • a full breakdown of errors, warnings and info notices

It's a useful at-a-glance view of a stylesheet's overall health and complexity.

Try it

Head to the CSS Validator, paste in your stylesheet, and press Validate Code. Results come back with exact line numbers, so you can jump straight to any issue.

Tip: if you run into anything unexpected, please let us know by contacting us. The engine is actively maintained, and we want to hear about edge cases.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee