# Cron expression validate

`cron-expression-validate` · version 1.0.0 · Other utilities · free, no key needed

Check whether a five-field cron expression is supported and return a validity flag with a reason code.

**Use when you need to: validate cron expression · check cron syntax · is this five field cron valid.**

## Decide before calling

Read the [versioned contract](/v1/tools/cron-expression-validate/versions/1.0.0) and the supported scope below. Reuse `cron-expression-validate@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `cron-expression-validate@1.0.0` for validate cron expression. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- validate cron expression
- check cron syntax
- is this five field cron valid
- lint a cron schedule
- verify cron field ranges
- detect unsupported cron syntax

## Not supported

- compute run times
- six-field cron with seconds
- named months or weekdays

## Behavior

- Vixie wildcard status is true when a field starts with *, including */n; if either day field starts with *, both day value sets must match; otherwise day matching uses OR.
- Validates POSIX.1-2024 crontab utility INPUT FILES section fields plus Vixie cron 3.0pl1 ranges, lists, and steps.
- A syntactically invalid, well-typed expression returns valid false rather than throwing.

## Input

- `expression` (string, required): min length 1; max length 128

## Output

- `expression` (string, required): min length 1; max length 128
- `valid` (boolean, required)
- `reason` (string or null, required)
- `standard_version` (constant "POSIX.1-2024 crontab utility, INPUT FILES", required)

## Limits

- max input bytes: 512
- max expression bytes: 128
- max field items: 60
- max output bytes: 4096

## Example

Request input:

```json
{
  "expression": "*/15 * * * *"
}
```

Response:

```json
{
  "result": {
    "expression": "*/15 * * * *",
    "valid": true,
    "reason": null,
    "standard_version": "POSIX.1-2024 crontab utility, INPUT FILES"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "cron-expression-validate",
  "version": "1.0.0",
  "input": {
    "expression": "*/15 * * * *"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/cron-expression-validate/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"expression":"*/15 * * * *"}'
```

The machine-readable contract is at [/v1/tools/cron-expression-validate/versions/1.0.0](/v1/tools/cron-expression-validate/versions/1.0.0).

### CLI

```sh
node cli.mjs run cron-expression-validate 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Base64url validate](/tools/base64url-validate): Check canonical base64url syntax and return validity plus the first invalid character when present.
- [Cron describe fields](/tools/cron-describe-fields): Parse a five-field cron expression and return each field’s expanded numeric values and wildcard status.
- [Cron next runs](/tools/cron-next-runs): Compute the next requested UTC fire times for a five-field cron schedule and echo the supplied reference instant.
- [Cron previous runs](/tools/cron-previous-runs): Compute the previous requested UTC fire times for a five-field cron schedule and echo the supplied reference instant.
- [Stats histogram](/tools/stats-histogram): Count decimal-string values in caller-supplied fixed bins and return below- and above-range totals.
- [Base64url encode](/tools/base64url-encode): Encode supplied UTF-8 text or hexadecimal bytes as base64url and return the encoded string.
