Cron expression for every 2 hours
0 */2 * * * runs at minute 0 of every second hour: 00:00, 02:00, 04:00 through to 22:00.
This tool runs in your browser. We never send what you type or paste to a server.
The expression
0 */2 * * * /path/to/commandThe expression has five fields, read left to right:
| Field | Value | Meaning here |
|---|---|---|
| Minute | 0 | at minute 0 |
| Hour | */2 | every 2nd hour, starting at 0: 0, 2, 4, … 22 |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | * | every day of the week |
When it runs
Starting from Wed 2027-01-06 10:07 UTC, the next runs are:
Wed 2027-01-06 12:00
Wed 2027-01-06 14:00
Wed 2027-01-06 16:00
Wed 2027-01-06 18:00
Wed 2027-01-06 20:00
Wed 2027-01-06 22:00Cron uses the time zone of the machine or service that runs it. The explainer at the top of this page shows the next runs in your own time zone.
Variations
0 1-23/2 * * * every 2 hours on the odd hours: 01:00, 03:00, … 23:00
30 */2 * * * every 2 hours at half past: 00:30, 02:30, …
0 */3 * * * every 3 hours
0 */6 * * * every 6 hours: 00:00, 06:00, 12:00, 18:00
0 8-18/2 * * * every 2 hours between 08:00 and 18:00
Steps that do not divide 24
The hour step counts from 0 and restarts at midnight. 2, 3, 4, 6, 8 and 12 divide 24, so their gaps are even. 0 */5 * * * runs at 00:00, 05:00, 10:00, 15:00 and 20:00, and then at 00:00 again, four hours later. Cron has no memory of the previous run, so a real every-5-hours cycle needs something else, such as a systemd timer with OnUnitActiveSec=5h or a rate(5 hours) schedule on AWS.
As with hourly jobs, do not forget the leading 0: * */2 * * * runs every minute of every second hour, 720 times a day.
Quartz adds a seconds field at the front, AWS adds a year at the end, and both need ? in one of the two day fields. See how the syntaxes differ.
The same schedule in other schedulers
| Scheduler | Expression |
|---|---|
| Unix cron, crontab | 0 */2 * * * |
| Kubernetes CronJob | schedule: "0 */2 * * *" |
| GitHub Actions | - cron: '0 */2 * * *' |
| Quartz (Java, Spring) | 0 0 0/2 * * ? |
| AWS EventBridge | cron(0 0/2 * * ? *) |
Questions
What is the cron expression for every 2 hours?
0 */2 * * *. It runs on the hour at 0, 2, 4 and so on up to 22.
How do I run a cron job every 2 hours starting at 1am?
0 1-23/2 * * * runs at 01:00, 03:00 and every second hour up to 23:00.