Cron Validator

Cron Validator

Validate cron syntax, check field ranges, and get helpful error messages.

Validate Cron Expression

Check syntax and field ranges

FieldRangeExamples
Minute0-590, 30, */5
Hour0-239, 0-17, */2
Day1-311, 15, 1,15
Month1-121, 1-6, */3
Weekday0-60=Sun, 1-5

Features

  • Strict syntax validation for standard Linux/Unix cron
  • Boundary checks (e.g., rejecting minute > 59 or month > 12)
  • Specific detection of invalid characters or typos
  • Range validation ensuring the start boundary is lower than the end boundary
  • Provides immediate feedback on exact character errors

Common Use Cases

  • Linting infrastructure-as-code (Terraform, Ansible) cron definitions
  • Preventing catastrophic server misfires caused by typos
  • Testing complex range and step configurations (`15-45/10`)
  • Ensuring GitHub Action or GitLab CI schedule triggers meet strict parser rules

Cron Syntax Errors

Because cron strings are just space-delimited sequences, a single typo can either fail silently or run a job 60 times an hour instead of once a day.

Common Traps the Validator Catches:

  • Out of Bounds: e.g., 0 25 * * * (Hour 25 does not exist).
  • Invalid Steps: e.g., *//5 * * * * (Double slash syntax error).
  • Reversed Ranges: e.g., 0 0 5-1 * * (Range must go from smaller to larger).
  • Field Count: Providing only 4 parameters instead of the required 5.

Examples

Invalid - Missing Required Field (Error)
* * * *
Invalid - Out of Bounds (Error)
0 0 32 * *
Valid - Valid Complex Range
5-20/5 0 * * 1,3,5

Frequently Asked Questions

Why did my CI pipeline reject a valid cron?
Different systems have different parser rules. For example, GitHub Actions does NOT support the `@daily` or `@hourly` alias strings, nor does it support non-standard steps like `W` or `L`. Always stick to the 5 baseline numeric columns for maximum compatibility.
Is `7` a valid Day of Week?
In many standard Linux implementations, `0` and `7` both represent Sunday. The validator normally accepts either, but it is best practice to simply use `0` to avoid parser bugs.
How do I specify a step size within a range?
Combine the hyphen and slash. For example, `10-50/10` means "every 10 units bounded between the 10th and 50th offset".

💡 Tips

  • Always validate complex strings if you use multiple commas combined with range hyphens (e.g. `1,15,30-45`).
  • Some tools prefer text abbreviations (`MON-FRI`) over numbers (`1-5`); ensuring both bounds use the same format helps prevent errors.