W3C CSS Validator API
Validate a stylesheet or a whole page's CSS against any CSS profile and get structured JSON errors and warnings. No API key required. Verified live example.
Endpoint tested and returned HTTP 200 on 2026-08-21
What is the W3C CSS Validator API?
The W3C CSS Validator (Jigsaw) offers a JSON output mode. `GET https://jigsaw.w3.org/css-validator/validator?uri=https://example.com&profile=css3&output=json` returns a `cssvalidation` object with a `validity` boolean plus error and warning counts. No API key is required.
The CSS validator is a separate service from the HTML checker, on a different host, with a completely different response shape, and conflating the two is the usual source of confusion. Here everything is nested under a single `cssvalidation` key, and there is an explicit `validity` boolean, which the HTML checker deliberately does not provide.
The `profile` parameter is what makes it genuinely useful rather than pedantic. Validating modern CSS against the default profile produces noise about properties the specification has since absorbed, so pin `profile=css3` or a more specific level and the results become actionable. The `timestamp` field is epoch milliseconds delivered as a string, while `date` next to it is a normal ISO 8601 value, which is an easy pair to mix up.
Quick facts
- Base URL
https://jigsaw.w3.org/css-validator- Authentication
- No key. W3C asks automated users to rate-limit themselves to roughly one request per second and to run a local instance for heavy use.
- Rate limit
- W3C's stated policy is no more than about one request per second for automated clients.
- Pricing
- Free and open source.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the W3C CSS Validator API
Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.
1. Validate a page's CSS and return JSON
GET https://jigsaw.w3.org/css-validator/validator?uri=https%3A%2F%2Fexample.com&profile=css3&output=json
curl 'https://jigsaw.w3.org/css-validator/validator?uri=https%3A%2F%2Fexample.com&profile=css3&output=json'const res = await fetch("https://jigsaw.w3.org/css-validator/validator?uri=https%3A%2F%2Fexample.com&profile=css3&output=json");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://jigsaw.w3.org/css-validator/validator?uri=https%3A%2F%2Fexample.com&profile=css3&output=json", timeout=20)
res.raise_for_status()
print(res.json()){
"cssvalidation": {
"uri": "https://example.com",
"checkedby": "http://www.w3.org/2005/07/css-validator",
"csslevel": "css3",
"date": "2026-08-21T07:46:18Z",
"timestamp": "1787298378011",
"validity": true,
"result": {
"errorcount": 0,
"warningcount": 0
}
}
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uri | string | Optional | URL of the page or stylesheet to validate. URL-encode it. https://example.com |
text | string | Optional | Raw CSS to validate instead of fetching a URL. Useful for snippets, though POST is better for large stylesheets. a{color:red} |
profile | string | Optional | CSS profile to validate against: `css3`, `css21`, `svg`, `mobile` and others. Pin this or you will get noise. css3 |
output | string | Required | Response format. Use `json`; the default is HTML. json |
warning | string | Optional | Warning verbosity: `0` for none, `1` or `2` for more, `no` to disable. 0 |
usermedium | string | Optional | Media type to validate for, such as `screen`, `print` or `all`. screen |
Response fields
cssvalidationobject- Everything is nested under this single key. There is no top-level status field.
cssvalidation.validityboolean- True when there are no errors. This is the field to branch on in CI; unlike the HTML checker there is an explicit boolean.
cssvalidation.result.errorcount / warningcountinteger- Counts only. The detailed `errors` and `warnings` arrays appear alongside them when there is something to report.
cssvalidation.csslevelstring- The profile actually applied, echoing your `profile` parameter. Check it: a typo silently falls back to the default.
cssvalidation.timestampstring- Epoch MILLISECONDS as a string. The neighbouring `date` field is ISO 8601, so prefer that one for display.
cssvalidation.checkedbystring- Which validator instance handled the request, useful when you run your own.
What you can build with the W3C CSS Validator API
- Gate a build on CSS validity alongside HTML validation
- Check a design system's compiled stylesheet for errors after a refactor
- Validate email CSS against a restricted profile before sending a campaign
- Audit legacy stylesheets for properties that never worked as intended
- Compare error counts across releases to track stylesheet quality
Common errors and how to fix them
HTML response instead of JSON
The `output` parameter was omitted.
Fix: Always send `output=json`. The service does not honour an `Accept` header for this.
Errors on valid modern CSS
You validated against the default profile rather than a modern one.
Fix: Pin `profile=css3`, and confirm the response's `csslevel` matches what you asked for.
Timeout on large sites
`uri` mode makes the validator fetch and parse every stylesheet on the page.
Fix: Validate individual stylesheet URLs, or POST the CSS text directly, rather than whole pages.
W3C CSS Validator API — frequently asked questions
Is the W3C CSS validator API free?
Yes, with no key. W3C asks automated clients to keep to roughly one request per second and to self-host the validator for heavy use.
How do I check a raw CSS snippet?
Pass it in the `text` parameter, or POST it. That avoids the validator having to fetch a URL and is much faster for small fragments.
Why does it report errors for CSS that works in browsers?
Browsers implement drafts and vendor extensions that the validator's profiles do not cover. Pin a profile, and treat vendor-prefixed warnings as informational.
Is this the same as the HTML validator?
No. It is a different service on a different host with a different response shape. The HTML checker returns a flat `messages` array; this one nests everything under `cssvalidation`.
Tools that pair with this API
CSS Minifier
Minify CSS online: remove comments and whitespace, drop trailing semicolons and shorten hex colors. See bytes and percent saved. Free, instant, private.
CSS Color Format Converter
Turn one colour into every modern CSS syntax at once: hex, rgb, hsl, hwb, lab, lch, oklab, oklch and display-p3, each with its own copy button.
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
HTML Minifier
Minify HTML online: strip comments, collapse whitespace between tags and shrink page size. See bytes saved instantly. Free, private, runs in your browser.
W3C CSS Validator is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.