# W3C HTML Validator (`service-paradis/w3c-html-reporter`) Actor

Validate the HTML of web pages or whole sites with the Nu Html Checker, the engine behind the W3C validator, running inside the actor: errors, warnings, line numbers and markup for every page.

- **URL**: https://apify.com/service-paradis/w3c-html-reporter.md
- **Developed by:** [Alexandre Paradis](https://apify.com/service-paradis) (community)
- **Categories:** Developer tools, SEO tools
- **Features:** Limited permissions
- **Stats:** 11 total users, 0 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## W3C HTML Validator

W3C HTML Validator checks the HTML of web pages against the HTML standard and reports every error and warning with its line, column and markup. It runs the [Nu Html Checker](https://validator.github.io/validator/), the engine behind the [W3C validator](https://validator.w3.org/nu/), inside the actor. There is no rate limit from the public W3C service, so you can check a whole site in one run.

### What does it check?

The Nu Html Checker reports what the W3C validator reports:

- **Errors**: invalid or misnested elements, missing required attributes (such as `alt` on images), duplicate attributes and IDs, obsolete elements, bad attribute values.
- **Warnings**: problems that are allowed but likely mistakes, such as a section without a heading or a missing `lang` attribute.
- **Info**: notes about the document.

### How to validate HTML for a whole website

1. Add the pages to check to **Start URLs**.
2. To check more than those pages, set **Link depth**. With 1, the actor also checks every page they link to on the same site, and with 2 the pages those link to.
3. Set **Maximum pages per start URL** to cap the run.
4. Click **Start**. The **Pages** view shows one row per page with its error and warning counts. The **Messages** view shows one row per message.

### Input

| Field | Description | Default |
|---|---|---|
| `startUrls` | Pages to check | required |
| `maxCrawlDepth` | 0 checks only the start URLs, 1 also checks the pages they link to on the same site, and so on | 0 |
| `maxPages` | Maximum pages checked for each start URL, including the pages reached from it | 100 |
| `minSeverity` | Lowest severity listed in `messages`: `error`, `warning` or `info`. Counts always include every message | `warning` |
| `proxyConfiguration` | Proxy settings. Off by default | no proxy |

```json
{
  "startUrls": [{ "url": "https://example.com" }],
  "maxCrawlDepth": 2,
  "maxPages": 50,
  "minSeverity": "error"
}
```

### Output

One item per checked page:

```json
{
  "url": "https://example.com/",
  "statusCode": 200,
  "valid": false,
  "counts": { "error": 8, "warning": 2, "info": 0 },
  "messages": [
    {
      "severity": "error",
      "type": "error",
      "subType": null,
      "message": "An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.",
      "extract": "d <b>bold\n<img src=\"photo.jpg\">\n<div>",
      "firstLine": 9,
      "firstColumn": 1,
      "lastLine": 9,
      "lastColumn": 21
    }
  ],
  "depth": 0,
  "checkedAt": "2026-10-15T16:30:12.114Z"
}
```

`valid` is `true` when the page has no error. Warnings do not make a page invalid. `type` and `subType` are the checker's own values (an error with the `fatal` subtype, or info with the `warning` subtype).

### How much does it cost?

The actor charges per checked page. The current price is on the **Pricing** tab. The validator starts with each run, which adds a few seconds, so checking many pages in one run is cheaper than many runs of one page.

### Good to know

- The actor checks the HTML the server sends, like the W3C validator does with a URL. Content added later by JavaScript is not checked.
- Only the HTML is checked. When given a URL, the public W3C validator also checks some HTTP response headers (for example `Content-Security-Policy`), so it can report a message or two more than this actor.
- Pages are sent to the validator as UTF-8. A page served in another encoding may get an extra message about its declared encoding.
- Pages that answer with an error status (404, 500...) are skipped and logged.
- Only links on the same host as the page are followed, and links to files (PDF, images, archives...) are ignored.

### Migrating from version 0.x

Version 1.0 checks pages with a validator inside the actor instead of calling validator.w3.org:

- One item per page, with counts and the list of messages, instead of one item per message. To get one row per message, use the **Messages** view or the API's `unwind=messages` parameter.
- `severity` is now `error`, `warning` or `info`. `type` and `subType` keep the checker's own values.
- New inputs: `maxCrawlDepth`, `maxPages` and `minSeverity`. `debug` is gone.
- No more failures from the public validator's rate limit.

### Support

Found a bug or need an option? Open an issue on the actor's **Issues** tab.

# Changelog

This Actor's version history is a separate document: https://apify.com/service-paradis/w3c-html-reporter/changelog.md

# Actor input Schema

## `startUrls` (type: `array`):

Pages to check.

## `maxCrawlDepth` (type: `integer`):

0 checks only the start URLs. 1 also checks the pages they link to on the same site, 2 the pages those link to, and so on.

## `maxPages` (type: `integer`):

Each start URL and the pages reached from it are checked up to this many pages.

## `minSeverity` (type: `string`):

The lowest severity listed in each page's messages. The counts always include every message.

## `proxyConfiguration` (type: `object`):

Pages are fetched without a proxy by default. Turn on Apify Proxy for sites that block data center traffic.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "maxCrawlDepth": 0,
  "maxPages": 100,
  "minSeverity": "warning",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `pages` (type: `string`):

One report per checked page, with its message counts and messages.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://apify.com"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("service-paradis/w3c-html-reporter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": [{ "url": "https://apify.com" }],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("service-paradis/w3c-html-reporter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call service-paradis/w3c-html-reporter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,service-paradis/w3c-html-reporter"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NOOmXbQehTNMgKC2d/builds/NzR6MYgxVQolwzT2d/openapi.json
