Skip to content
Webmaster Tools
Dev utilitiesCron ParserEvery 12 hours

Cron every 12 hours

The cron expression for every 12 hours is 0 */12 * * *, which runs at midnight and noon. How to pick other times, like 9:00 and 21:00, and GitHub Actions and AWS forms.

Cron expression
0 */12 * * *
See the next run times

The expression

0 */12 * * *

Runs at minute 0 of hours 0 and 12: at 00:00 and 12:00, twice a day.

Field Value Meaning
Minute 0 at minute 0
Hour */12 every 12th hour, starting at 0
Day of month * every day
Month * every month
Day of week * every day of the week

*/12 in the hour field only ever matches 0 and 12, so 0 0,12 * * * is the same schedule and arguably easier to read. Neither counts from when you installed the job: saving it at 15:00 means the first run is at midnight.

Variants

Schedule Expression
9:00 and 21:00 0 9,21 * * *
6:00 and 18:00 0 6,18 * * * or 0 6-23/12 * * *
00:30 and 12:30 30 */12 * * *
Midnight and noon, weekdays only 0 */12 * * 1-5
Every 6 hours 0 */6 * * *
Once a day at midnight 0 0 * * *

Any two hours 12 apart give an even 12-hour cadence. A list (6,18) says it most plainly; a step on a range (6-23/12) does the same thing.

Where to write it

  • crontab (Linux, macOS): 0 */12 * * * /usr/local/bin/renew.sh in crontab -e. Midnight and noon are in the server's time zone.
  • GitHub Actions: on: schedule: - cron: '0 */12 * * *'. That's 00:00 and 12:00 UTC: 8 p.m. and 8 a.m. in New York during daylight saving time, 7 p.m. and 7 a.m. in winter. Minute 0 is the most congested; prefer something like 41 */12 * * *.
  • Kubernetes CronJob: schedule: "0 */12 * * *", with timeZone: to make midnight local.
  • AWS EventBridge: cron(0 0/12 * * ? *), six fields with ? in day of week, or rate(12 hours) (counted from when the rule was created, so not necessarily midnight and noon).

Common mistakes

  • 0 12 * * * runs once a day, at noon.
  • */12 * * * * runs every 12 minutes, 120 times a day.
  • Certificate renewals at exactly 00:00. Tools such as certbot ask you to pick a random minute so the CA isn't hit by everyone at once; the same applies to any shared API.
  • "12 hours after the last run". Cron uses the wall clock. If you need an interval from the previous run, use a systemd timer with OnUnitActiveSec=12h.

Paste any expression into the Cron Expression Parser to see it in words and its next run times.