</>
ValidateHTML

Missing Semicolon in CSS

Every CSS declaration must end with a semicolon. When you forget one, the browser tries to parse the next line as part of the current value. This usually breaks both the current declaration AND the next one.

Why It Matters

A missing semicolon is the most common CSS syntax error. It silently breaks two rules at once: the one missing the semicolon and the one after it. This makes it especially confusing because the rule that appears broken isn't the one with the actual error.

Common Causes

  • Hand-writing declarations and forgetting the semicolon, most often on the last property in a block.
  • Reordering or pasting lines so a value runs straight into the next property name.
  • Editing minified or single-line CSS where the missing separator is hard to see.

Code Examples

Bad CSS
.card {
  background: #fff     /* missing semicolon */
  border-radius: 8px;
  padding: 20px;
  color: #333          /* missing semicolon */
  font-size: 14px;
}
Good CSS
.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  color: #333;
  font-size: 14px;
}

How to Fix

  • 1Always end every CSS declaration with a semicolon, including the last one in a block.
  • 2When a CSS rule doesn't work, check the line ABOVE it for a missing semicolon.
  • 3Use a CSS validator to catch missing semicolons automatically.
  • 4Configure your editor to auto-insert semicolons (Prettier, stylelint).

Frequently Asked Questions

Do I really need a semicolon after the last declaration?
It is technically optional after the final declaration in a block, but always adding it is the safe habit. It prevents a parse error the moment you add another line below it later.
Why does the rule below the missing semicolon also break?
The browser keeps reading until it finds a semicolon or closing brace, so the next property name gets absorbed into the unterminated value. That makes both the original and the following declaration invalid.
How do I find a missing semicolon fast?
When a declaration mysteriously does nothing, check the line directly above it. A CSS validator pinpoints the exact line, and formatters like Prettier reinsert missing semicolons on save.

Check Your CSS Now

Our CSS validator detects this error automatically and shows the exact line number.

Open CSS Validator
Recommended

Cloudways · Managed Cloud Hosting

Fix this CSS error, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).

Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303

Start free trial

Related CSS Errors

View all CSS errors