Cron Expression Generator
Build cron expressions visually or describe existing ones in human-readable form.
Cron Expression Generator turns cryptic five-field schedules into plain English and back again. You can build expressions visually in Field Builder — separate selects for Minute, Hour, Day of Month, Month, and Day of Week — or paste a raw expression into Direct Input and hit Describe to get bulleted phrases like "Runs every 5 minutes" or "Runs at 9:00 AM". Fourteen Quick Presets ("Every minute", "Every day at midnight", "Monday to Friday at 9 AM", …) jump you straight to a described expression.
Both directions share one Result block: an Expression code block with copy icon and a Description list you can hand to a teammate. Share encodes the full builder state into a URL hash so a colleague can reopen your exact fields, mode, and description. Generation and humanization are implemented in-repo with no cron-parser dependency, and nothing is sent over the network.
How it works
generateCron joins the five field values with spaces. describeCron splits the expression on whitespace, requires exactly 5 parts (anything else yields "Invalid cron expression: must have exactly 5 fields"), then runs describeField per slot: handle *, */n steps, a-b ranges (with day/month name expansion like 1-5 → "Monday through Friday"), a,b,c lists, and single values. Results compose into "Runs …" bullets stored in cronGeneratorSlice.
Quick Presets come from COMMON_EXPRESSIONS (14 entries) and switch you to Direct Input with the expression pre-filled and described. Share uses copyShareableUrl('cron-generator', { fields, directInput, mode, expression, description }) so reload restores everything via the URL hash. All logic lives in lib/cronGenerator.ts — no outbound calls.
How to use
- Step "Configure" — click a Quick Preset (auto-switches to Direct Input + describes) OR pick "Field Builder" mode.
- In Builder, set the Minute, Hour, Day of Month, Month, and Day of Week selects (option lists include *, */5, */15, 0, 15, etc.).
- Click "Generate" — expression + human description appear under "Result" (toast "Cron expression generated!").
- Or switch to "Direct Input", type e.g. */5 * * * *, click "Describe".
- Read the "Description" bullets ("Runs every 5 minutes", "Runs at 9:00 AM", …).
- Copy the expression via the icon next to the "Expression" label.
- "Share" copies a URL restoring fields/mode/expression (toast "Link copied!").
- "Clear" resets fields, direct input, and results (toast "Cleared!").
Tips
- Presets jump you to Direct mode with the expression pre-filled and already described — fastest path for common schedules.
- Wrong field count yields "Invalid cron expression: must have exactly 5 fields" — this tool is 5-field only, no seconds field.
- Share round-trips the full builder state (fields, mode, expression, description) through the URL hash.
- Day-of-week supports ranges like 1-5, described as "Monday through Friday" via day-name expansion.
Cron Expression Generator FAQ
5-field or 6-field cron?
Exactly 5 (minute hour dom month dow) — describeCron rejects any other length with the field-count error.
How do I explain */15 * * * *?
describeField's step handling turns it into "Runs every 15 minutes".
Are there presets?
Yes — 14 COMMON_EXPRESSIONS chips under "Quick Presets", from "Every minute" to "Every Saturday at midnight".
Can I share my expression?
Yes — Share encodes fields, mode, expression, and description into the URL hash via copyShareableUrl.
Does it need the internet?
No — generation and humanization are implemented in-repo in lib/cronGenerator.ts with no cron-parser package and no network calls.
Credits
- In-repo describeCron — Generation + humanization in lib/cronGenerator.ts (no cron-parser dependency)