Parsing Cron Expressions Programmatically

Cron expressions are powerful but cryptic. What does */15 9-17 * * 1-5 mean? Is 0 0 29 2 * valid? When will 0 */6 * * * run next?

We built a free REST API that answers all three questions. No signup, no API key — just send a GET request. Part of CronPing, our cron job monitoring service.

Three Endpoints, Zero Auth

1. Describe: Human-Readable Translations

curl "https://cronping.anethoth.com/api/v1/cron/describe?expr=*/15+9-17+*+*+1-5"
{
  "expression": "*/15 9-17 * * 1-5",
  "description": "Every 15 minutes, hours 9-17, Monday through Friday",
  "fields": {
    "minute": {"raw": "*/15", "description": "Every 15 minutes", "values": [0,15,30,45]},
    "hour": {"raw": "9-17", "description": "Hours 9-17", "values": [9,10,11,12,13,14,15,16,17]},
    "day_of_month": {"raw": "*", "description": "Every day of month"},
    "month": {"raw": "*", "description": "Every month"},
    "day_of_week": {"raw": "1-5", "description": "Monday through Friday", "values": [1,2,3,4,5]}
  },
  "is_valid": true
}

The description is generated by analyzing each field and composing a natural-language summary. It handles step values (*/5), ranges (9-17), lists (1,3,5), named days (MON-FRI), and named months (JAN-DEC).

2. Next Runs: Calculate Upcoming Execution Times

curl "https://cronping.anethoth.com/api/v1/cron/next?expr=0+9+*+*+1&count=5"
{
  "expression": "0 9 * * 1",
  "description": "At 09:00, every Monday",
  "next_runs": [
    "2026-04-20T09:00:00Z",
    "2026-04-27T09:00:00Z",
    "2026-05-04T09:00:00Z",
    "2026-05-11T09:00:00Z",
    "2026-05-18T09:00:00Z"
  ],
  "count": 5,
  "timezone": "UTC"
}

Returns up to 10 upcoming execution times in UTC. Useful for verifying a cron schedule before deploying it, or for building scheduling UIs that show users when their next job will run.

3. Validate: Syntax Checking

curl "https://cronping.anethoth.com/api/v1/cron/validate?expr=0+25+*+*+*"
{
  "expression": "0 25 * * *",
  "is_valid": false,
  "error": "Hour value 25 out of range (0-23)"
}

Validates syntax, value ranges, and field counts. Returns a specific error message explaining what's wrong — not just a boolean. Catches common mistakes: invalid ranges, out-of-bounds values, wrong number of fields.

Use Cases

  • CI/CD pipelines — validate cron expressions in config files before deployment
  • Scheduling UIs — show users when their next job will run
  • Documentation — auto-generate human-readable descriptions for crontab entries
  • Monitoring dashboards — display next expected run time for each scheduled job
  • Testing — verify cron schedules in unit tests without running the scheduler

Integration Example: GitHub Actions Validator

Validate a cron expression before committing a workflow file:

#!/bin/bash
CRON="0 */6 * * *"
RESULT=$(curl -s "https://cronping.anethoth.com/api/v1/cron/validate?expr=$(echo $CRON | sed 's/ /+/g')")
VALID=$(echo $RESULT | jq -r '.is_valid')

if [ "$VALID" = "true" ]; then
  DESC=$(echo $RESULT | jq -r '.description')
  echo "✓ Valid cron: $DESC"
else
  ERROR=$(echo $RESULT | jq -r '.error')
  echo "✗ Invalid cron: $ERROR"
  exit 1
fi

CORS Enabled

All three endpoints have CORS enabled for GET requests from any origin. You can call them directly from browser JavaScript:

const resp = await fetch(
  "https://cronping.anethoth.com/api/v1/cron/describe?expr=" +
  encodeURIComponent("0 9 * * 1-5")
);
const data = await resp.json();
console.log(data.description);
// "At 09:00, Monday through Friday"

This makes it easy to build cron schedule pickers, validation forms, or scheduling previews in web apps.

Rate Limits

  • 60 requests per minute per IP
  • No API key required
  • JSON responses with proper HTTP status codes
  • Error responses include helpful hints

Need cron job monitoring with webhook alerts when jobs miss their schedule? CronPing does that — free tier includes 3 monitors.

Interactive Tool

Don't want to use the API? The Cron Expression Helper is a visual builder with preset schedules, real-time parsing, and a reference table. Use it to build expressions, then embed the API in your code.

Try CronPing free

A free REST API that parses cron expressions into human-readable descriptions, validates syntax, and calculates upcoming execution times. Get started with our free tier — no credit card required.

Get started free →