Cron Expression for Every 2 Hours
Run a job every 2 hours with 0 */2 * * *. It fires at minute 0 of every even hour — 00:00, 02:00, 04:00 and so on up to 22:00 — which is 12 runs a day.
At minute 0 of every 2nd hour.
0 */2 * * *Standard 5-field crontab syntax. Day of month and day of week are OR'd when both are set.
What it does
Here the step sits in the hour field. */2 takes every second value of 0–23, giving 0, 2, 4 … 22, and the 0 in the minute field pins each run to the top of those hours. Both parts matter: * */2 * * * would run every minute during the even hours — 720 times a day instead of 12.
Two-hourly jobs are a good middle ground for work that's expensive to run but shouldn't wait all day: re-crawling a small website for broken links, importing product feeds from partners, refreshing machine-learning features from a data warehouse, or pruning old rows from a busy table. Twelve evenly spaced runs mean the data is never more than two hours old.
Counting always starts from the first value of the range, so */2 means even hours. For odd hours — 01:00, 03:00 … 23:00 — give the step an explicit start: 0 1-23/2 * * *. That's handy when two heavy jobs both run every two hours and you want them to alternate rather than collide.
How 0 */2 * * * works, field by field
| FIELD | VALUE | MEANING |
|---|---|---|
| Minute | 0 | minute 0 |
| Hour | */2 | every 2 hours (0, 2, 4 … 22) |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | * | every day of the week |
Put together, cron reads 0 */2 * * * as: “At minute 0 of every 2nd hour.”
To see further ahead, paste the expression into the cron calculator, which lists the next ten run times and counts how many times the schedule runs in a year.
Frequently asked questions
Why does 0 */2 * * * only run on even hours?
A step counts from the start of its range. In the hour field * starts at 0, so */2 produces 0, 2, 4 … 22. To start from 1, write the range explicitly: 1-23/2.
Does the every-2-hours schedule stay even across midnight?
Yes. The last run of the day is at 22:00 and the next is at 00:00, two hours later, because 24 divides evenly by 2. Steps that don't divide 24, such as */5, leave a shorter gap at midnight.
How do I run every 2 hours during the day only?
Combine a range with the step: 0 8-20/2 * * * runs at 8:00, 10:00, 12:00, 14:00, 16:00, 18:00 and 20:00, and nothing overnight.