Skip to content
Back to blog
Field notes · cron

How to Read and Write Cron Expressions (5-Field POSIX)

Learn how to read, write, and debug 5-field POSIX cron expressions with a visual builder, plain-English explanations, and a live preview of the next runs.

5 min readSimon Wong

Cron is one of those technologies you only touch a few times a year, just often enough to forget the syntax in between. Five terse fields, a handful of special characters, and the schedule looks fine until it doesn't fire when you expected. A visual cron builder turns those five fields into something you can reason about, with plain-English explanations and a preview of the next executions in your local timezone.

Why a Visual Cron Builder

Most cron mistakes come from confidence rather than ignorance. You glance at 0 9 * * 1-5 and read "weekdays at 9 AM," then deploy it on a server set to UTC and miss the morning run. Or you write */7 * * * * thinking "every seven minutes" and don't realise the schedule resets at the top of every hour, leaving uneven gaps. A visual builder catches both classes of bug fast: it shows what the expression literally means, and it lists the next few executions so you can sanity-check the rhythm before any code runs.

The other reason to use a builder is learning. Cron syntax is dense by design, but the rules are small once you see them. Watching the explanation update as you toggle fields is the fastest way to internalise how *, */N, ranges, and lists compose. After a few minutes you stop reaching for "cheatsheet cron" in your search bar.

The 5-Field POSIX Anatomy

Standard POSIX cron uses five fields separated by spaces. Some hosted schedulers add a sixth field for seconds, but the classic crontab format does not, and that's what we focus on here.

FieldRangeExample
Minute0-590 (top of hour)
Hour0-239 (9 AM local)
Day of month1-311 (first of month)
Month1-12* (any)
Day of week0-61-5 (Mon-Fri, 0=Sun)

Each field accepts five forms: a wildcard *, a single number, a range A-B, a step */N, a stepped range A-B/N, and a comma-separated list A,B,C. You can combine forms inside a list, so 0,15,30,45 and */15 are equivalent in the minute field.

Some cron implementations support extras like L (last day of month), W (nearest weekday), # (nth weekday of month), and three-letter names (MON, JAN). Those are non-standard and not portable across runtimes - our builder intentionally rejects them so you don't write a schedule that breaks on a different host. If you need that syntax, target a specific scheduler that documents it.

Building Step by Step

Let's walk 0 9 * * 1-5 from left to right and watch each field commit to a precise meaning.

Start with the minute field. 0 means exactly minute zero of the hour, not "every minute starting at zero." That's a common slip when you switch from a step like */5, which would mean every five minutes throughout the hour.

The hour field 9 pins the run to the 9 AM hour in the server's local timezone. Combined with minute 0, that's exactly 09:00. If you wanted "every hour starting at 9 AM," you'd write 9-23, not 9.

Day-of-month * means any day. Note that POSIX cron has a quirky OR semantic: when both day-of-month and day-of-week are restricted (neither is *), the schedule fires on dates that match either field. Most people expect AND, so the safest pattern is to leave one of the two as * whenever possible, which is what we do here.

Month * says any month, no surprises.

Day-of-week 1-5 means Monday through Friday (Sunday is 0, Saturday is 6). Combined with everything else, you get "at 09:00 on weekdays." Drop the 1-5 to * and you'd run every day; bump the start to 2-6 and you'd shift the work week by a day, which is a useful trick for regions where the weekend lands differently.

Common Pitfalls

Day-of-month vs day-of-week (POSIX OR)

If you write 0 9 15 * 1 expecting "9 AM on the 15th only if it's also a Monday," POSIX cron will instead run on the 15th of every month and on every Monday. Most modern schedulers preserve this behaviour for compatibility. Pick one of the two fields and leave the other wildcarded.

Server timezone vs user timezone

Cron evaluates against the daemon's local clock, which on most cloud servers is UTC. A schedule that reads "09:00" in your editor may not be 09:00 for your users. Either set the server's TZ explicitly, document the timezone in the comment above the entry, or use a scheduler that lets you specify a timezone per job. Our preview shows times in your browser's local zone, which makes mismatches obvious.

*/7 is not "every 7 minutes" across the whole day

Step expressions reset at the start of each field's range. */7 in the minute field fires at 0, 7, 14, 21, 28, 35, 42, 49, 56, then back to 0 at the next hour. The gap between 56 and 60 is only four minutes. If you need an exactly-every-seven-minutes loop, use a job runner with sleep semantics, not cron.

Daylight saving time

When the clock springs forward, the missed hour's minute-level schedules typically don't run. When it falls back, that hour is replayed and your job may run twice. Critical jobs should be idempotent or pinned to UTC.

Local laptop vs production cluster

Editing your laptop's crontab is fine for personal automation, but production schedules belong in version-controlled config (Kubernetes CronJob, GitHub Actions schedule, etc.). Always paste the final expression into your tool of choice and verify the next-runs preview matches what the runtime will compute.

FAQ

Can I run something every 30 seconds? Not with standard 5-field cron. Use a scheduler that supports a seconds field or a long-lived process with its own timer.

How do I run a job once? Cron is for repeating schedules. For one-shot runs use at, a workflow trigger, or a job queue.

What does 0 0 1 1 * mean? Midnight on January 1st, every year - your annual reminder schedule.

Open our cron expression builder to edit any field interactively, see a plain-English explanation, and preview the next five executions in your local timezone. If you also work with auth tokens or text patterns, try our JWT decoder and regex tester.