Cron Syntax Explained: The 5 Fields and the Expressions You'll Actually Use (with a free generator)

Published: (June 6, 2026 at 09:22 AM EDT)
3 min read
Source: Dev.to

Source: Dev.to

Every time I need a cron expression, I stare at five numbers and asterisks and second-guess myself. Is 0 0 * * 0 Sunday or Saturday? Does day-of-week start at 0 or 1? This is the mental model that finally made it click for me. ┌───────────── minute (0–59) │ ┌───────────── hour (0–23) │ │ ┌───────────── day of month (1–31) │ │ │ ┌───────────── month (1–12) │ │ │ │ ┌───────────── day of week (0–6, Sunday = 0) │ │ │ │ │


  • means “every”. A number means “at exactly this one”. That covers about 90% of what you’ll write.
  • — every value (* * * * * = every minute) , — a list (0 9,17 * * * = at 9:00 and 17:00)
  • — a range (0 9-17 * * * = every hour from 9:00 to 17:00) / — a step (*/15 * * * * = every 15 minutes)

Expression When it runs

*/5 * * * * Every 5 minutes

0 * * * * Every hour, on the hour

0 0 * * * Every day at midnight

0 9 * * 1-5 9:00 AM, Monday–Friday

0 0 1 * * Midnight on the 1st of every month

0 0 * * 0 Midnight every Sunday

30 2 * * * 2:30 AM daily (handy for backups)

Day-of-week is 0–6, with Sunday = 0 (most systems also take 7 for Sunday). So 0 0 * * 0 is Sunday, not Saturday. Set both day-of-month and day-of-week, and cron treats it as OR. 0 0 1 * 1 runs on the 1st of the month or any Monday — not “only when the 1st lands on a Monday”. This one quietly doubles how often your job fires, and it’s a pain to debug. The fastest sanity check is to turn the expression into plain English and see if it matches what you meant. I got tired of doing that in my head, so I built a free no-login cron tool that goes both ways — describe a schedule and get the expression, or paste an expression and see the next run times: https://forgly.dev/tools/cron-generator If you just want a copy-paste list of common schedules, there’s a cheat-sheet here: https://forgly.dev/cron The trick that stuck for me: stop reading cron right-to-left in your head and just read it as a sentence — “at minute X, hour Y, on these days.”

0 views
Back to Blog

Related posts

Read more »

Mobile Midsommer Madness

!Cover image for Mobile Midsommer Madnesshttps://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploa...