devtoolslib
ToolsBlogsAbout
Get started
devtoolslib
ToolsBlogsAboutContactPrivacyTerms

© 2026 DevToolsLib.

Home / Blog / Post
✦DevelopmentOctober 18, 2025

Cron Expressions Explained: A Complete Guide with Examples

Cron syntax looks cryptic until you understand its five fields. This guide breaks down every part with real examples, common mistakes, and the schedules developers actually need.

By DevToolsLib Team·5 min read

Cron is one of the oldest tools in Unix. It schedules commands to run automatically at specified intervals — backups, report generation, cache clearing, health checks, newsletter sends. If you've ever set up a server-side task, you've likely written a cron expression.

The syntax looks intimidating at first: */15 9-17 * * 1-5. But it follows a simple 5-field pattern, and once you understand it, you'll read and write cron expressions without thinking.

The Five Fields

┌ minute      (0–59)
│ ┌ hour       (0–23)
│ │ ┌ day of month (1–31)
│ │ │ ┌ month      (1–12)
│ │ │ │ ┌ day of week  (0–6, Sun=0)
│ │ │ │ │
* * * * *

Every field can contain:

  • * — any value (matches all)
  • n — exact value
  • a-b — range (inclusive)
  • */n — step (every n units)
  • a,b,c — list of values

Common Expressions

| Expression | Meaning | |---|---| | * * * * * | Every minute | | 0 * * * * | Every hour, on the hour | | 0 9 * * * | Every day at 9:00 AM | | 0 9 * * 1-5 | Weekdays at 9:00 AM | | */15 * * * * | Every 15 minutes | | 0 9,17 * * * | At 9am and 5pm daily | | 0 0 1 * * | First day of every month at midnight | | 0 0 * * 0 | Every Sunday at midnight | | 30 4 1,15 * * | 4:30am on the 1st and 15th | | 0 2 * * 6 | Every Saturday at 2:00 AM |

Special Characters In Depth

Asterisk *

Matches everything. * * * * * runs every minute of every hour of every day.

Comma ,

Specifies a list. 0 9,12,17 * * * runs at 9am, noon, and 5pm.

Hyphen -

Specifies a range. 0 9-17 * * * runs every hour between 9am and 5pm inclusive.

Slash /

Specifies a step. */10 * * * * runs every 10 minutes. 0 */6 * * * runs every 6 hours (at midnight, 6am, noon, 6pm).

Combining

*/15 9-17 * * 1-5 — every 15 minutes, between 9am and 5pm, Monday through Friday. This is the expression for "during business hours" jobs.

Day of Week Values

Different systems handle day-of-week numbering differently:

| Value | Day | |---|---| | 0 | Sunday | | 1 | Monday | | 2 | Tuesday | | 3 | Wednesday | | 4 | Thursday | | 5 | Friday | | 6 | Saturday | | 7 | Sunday (some systems) |

Some cron implementations accept SUN, MON, TUE, etc. Some also accept 7 as Sunday in addition to 0. Always check your platform's documentation.

Common Mistakes

Confusing UTC and local time. Cron on most servers runs in UTC. 0 9 * * * means 9am UTC, which is 5am Eastern or 2am Pacific. Always convert to UTC or configure timezone explicitly.

Day of month and day of week are OR'd. 0 0 1 * 1 runs on the 1st of every month OR every Monday — not only Mondays that fall on the 1st. To target a specific weekday-of-month, you need application logic.

No sub-minute precision. Standard cron is minute-granular. If you need something to run every 10 seconds, cron isn't the right tool — use a process manager with a loop, or a more modern scheduler like GitHub Actions, AWS EventBridge, or Inngest.

Missing the trailing newline. Crontab files require a newline at the end. Some systems silently drop the last entry without it.

Platform Differences

GitHub Actions uses a cron-like syntax in workflow files:

on:
  schedule:
    - cron: '0 9 * * 1-5'

Note: GitHub Actions minimum interval is every 5 minutes, and jobs may be delayed during high load.

Vercel Cron Jobs (Next.js) use the same syntax in vercel.json:

{ "crons": [{ "path": "/api/cron", "schedule": "0 9 * * *" }] }

AWS EventBridge uses a slightly different syntax with 6 fields (adds seconds or year). Their documentation is the authority for AWS-specific expressions.

Build Any Schedule Instantly

Use our Cron Builder to construct expressions visually — set each field with inputs and common presets like "weekdays 9am" or "first of month." See the next 5 run times in your local timezone so there are no surprises.

— Tagged with

CronCron ExpressionCron BuilderCron SyntaxCrontabScheduled JobsUnix CronJob SchedulerLinux CronDevOpsDeveloper ToolsDevToolsLib
— thanks for reading.← Back to the blog