DevOpsTools & Guides

Cron Expression Examples – Complete Guide for Developers

Compose expressions field by field and preview the next run times

No signup • Runs in browser • Free

Build Cron Expressions Instantly →

You need a job to run every weekday at 9 AM. You write 0 9 * * 1-5 — but is that Monday through Friday, or Sunday through Thursday? You add a nightly backup at midnight and later realize it ran on Sunday when the server was under load. Cron expressions look simple until one wrong field costs you a missed job or an unexpected bill. The DevToolBox Cron Builder shows a plain-English description and previews the next five run times before you deploy.

Cron expressions show up in almost every production system. Scheduled database backups, nightly report generation, cache invalidation jobs, certificate renewals, Kubernetes CronJobs, GitHub Actions workflows — all of them rely on the same five-field syntax that has been around since the 1970s. If you have ever stared at 0 3 * * 1-5 and had to think twice about what it means, this guide covers the format from the ground up along with practical cron expression examples you can use directly.

# The five fields — easy to mix up under pressure:
# ┌── minute (0–59)
# │ ┌── hour (0–23)
# │ │ ┌── day of month (1–31)
# │ │ │ ┌── month (1–12)
# │ │ │ │ ┌── day of week (0=Sun, 1=Mon … 6=Sat, 7=Sun)
# │ │ │ │ │
  * * * * *   ← every minute (the most common test expression)

0 9 * * 1-5   ← 9 AM, Monday–Friday  ✓
0 9 * * 0-4   ← 9 AM, Sunday–Thursday  ✗ (off-by-one on day-of-week)

Quick summary

  • Five fields: minute, hour, day-of-month, month, day-of-week.
  • Supports * wildcards, ranges (1-5), lists (1,3,5), and steps (*/15).
  • Cron runs in the server timezone — set TZ=UTC to avoid surprises.
  • DevToolBox tools run entirely in your browser — no signup.

What Is Cron?

Cron is a Unix job scheduler that runs commands on a defined schedule. A cron daemon runs in the background and checks once per minute whether any scheduled jobs need to execute. Jobs are defined in a crontab file, where each line specifies a schedule and a command.

Beyond traditional Unix cron, the same format is used by AWS EventBridge, GitHub Actions, Kubernetes CronJobs, Jenkins, and most CI/CD platforms. The syntax is not perfectly standardized across all of them — but the core five-field format is consistent enough that understanding it once transfers broadly. Cron schedules are often defined alongside YAML config files in CI/CD pipelines, making both formats worth knowing well.

Cron Format Breakdown

A standard cron expression has five fields separated by spaces, in this order:

  • Minute — 0–59
  • Hour — 0–23
  • Day of month — 1–31
  • Month — 1–12
  • Day of week — 0–7 (both 0 and 7 are Sunday)

Each field accepts a specific value, a wildcard (*), a range (1-5), a list (1,3,5), or a step (*/15).

# ┌────────── minute (0–59)
# │ ┌──────── hour (0–23)
# │ │ ┌────── day of month (1–31)
# │ │ │ ┌──── month (1–12)
# │ │ │ │ ┌── day of week (0–7, 0 and 7 = Sunday)
# │ │ │ │ │
# * * * * *

* * * * *        → every minute
0 3 * * *        → every day at 3 AM
*/15 * * * *     → every 15 minutes
0 9 * * 1-5      → weekdays at 9 AM
0 0 1 * *        → first day of every month at midnight

Common Cron Expression Examples

  • * * * * * — Every minute. Useful for testing that a job is being picked up.
  • */15 * * * * — Every 15 minutes: at :00, :15, :30, and :45. Common for health checks and cache refresh jobs.
  • 0 * * * * — Every hour on the hour.
  • 0 0 * * * — Every day at midnight. Common for daily cleanup tasks and log rotation.
  • 0 3 * * * — Every day at 3 AM. Shifted off midnight to avoid contention with other nightly jobs.
  • 0 9 * * 1-5 — Every weekday at 9 AM. Monday through Friday only.
  • 0 8 * * 1 — Every Monday at 8 AM. Weekly jobs like summary emails or analytics rollups.
  • 0 0 1 * * — First day of every month at midnight. Monthly billing jobs and archival tasks.
  • 0 8,20 * * * — Twice a day at 8 AM and 8 PM.
  • */30 9-18 * * 1-5 — Every 30 minutes between 9 AM and 6 PM on weekdays.

Not sure if your expression is right? Use the Cron Builder to verify it with a plain-English description and a preview of the next five run times. Cron schedules commonly appear in the same stack as JSON config files — both are worth having a browser tool for.

Common Cron Mistakes

  • Off-by-one on day-of-week. Sunday is 0 (some systems also accept 7). Monday is always 1. Always double-check the numbering for your platform.
  • Timezone confusion. Cron runs in the server's local timezone by default. Set TZ=UTC explicitly if you want UTC-pinned schedules.
  • Day-of-month and day-of-week use OR logic. When both fields are set to non-* values, most implementations run the job if either condition is true — not only when both match.
  • No protection against job overlap. Cron does not prevent a new instance from starting if the previous one is still running. Use a locking mechanism for jobs with side effects.
  • Extra fields on some platforms. AWS EventBridge and Quartz Scheduler use a six-field format with a seconds field. GitHub Actions uses standard five-field UTC cron. Check your platform's documentation.

Frequently Asked Questions

What does */5 mean in a cron expression?

The */n syntax means every n units starting from the minimum value. So */5 in the minute field means every 5 minutes: at :00, :05, :10, :15, and so on.

How do I schedule a job for the last day of the month?

Standard cron does not have a last-day-of-month token. The common workaround is to schedule on the first of the following month and look back, or use a wrapper script that checks whether tomorrow is the first day of the next month. Some extended implementations like Quartz support an L token, but it is non-standard.

Why is my cron job not running even though the expression looks correct?

Check in order: confirm the cron daemon is running, verify the server timezone matches your assumption, check that the command path is correct (cron runs with a minimal environment and does not inherit your shell's PATH), and look at the system mail or cron log for error output from the job itself.

Is it safe to use a browser-based cron builder?

Yes. The DevToolBox Cron Builder runs entirely in your browser — no expression you enter is sent to a server. You can safely build and verify schedules for internal jobs without any data leaving your machine.

Conclusion

The five-field cron syntax is compact enough to write from memory once you internalize the field order — minute, hour, day-of-month, month, day-of-week — and the handful of value types available in each position. Most real-world scheduling requirements map to a small set of patterns.

When you need to build or verify a cron expression, DevToolBox Cron Expression Builder lets you compose expressions field by field, see a plain-English description of the schedule, and preview the next five run times. DevToolBox tools run entirely in your browser — no signup, no install, nothing sent to a server.

Build your cron expression in seconds

Compose expressions field by field, preview next run times, and get plain-English descriptions. Free, no signup, browser-only.

Build Cron Now →

Related Articles

Helpful tools for DevOps