CronTool
Cron expression editor & debugger

node-cron — Node.js cron syntax & examples

node-cron is the most-installed cron library on npm — a light wrapper that schedules JavaScript callbacks on cron-style expressions. It supports 5- and 6-field cron syntax, IANA timezones, and start/stop control. It does not support the L / W / # modifiers — for those, use a Quartz-flavoured library or a runtime check.
For last-day-of-month with node-cron, schedule daily and check new Date().getDate() vs the last day of the month — same pattern as the robfig/cron approach.

Examples

  • 018***
    Every day at 18:00
  • 0*/5***
    Every 5 hours
  • 018**1-5
    Weekdays at 18:00
  • 001**
    Once a month

Cheatsheet

FieldRequiredValues RangeWildcardsminuteYes0-59, - * / hourYes0-59, - * / day of monthYes1-31, - * / L W monthYes1-12, - * /day of weekYes0-7, - * / L

Calendar

View future cron matches in a calendar

April 2026

Showing next 1000 cron schedules

Loading...

Basic node-cron usage

import cron from 'node-cron';

// Every weekday at 09:00 New York time
cron.schedule(
  '0 9 * * 1-5',
  () => {
    console.log('Tick');
  },
  { timezone: 'America/New_York' }
);

Sub-minute with the seconds field

// Every 30 seconds (6-field with seconds at the front)
cron.schedule('*/30 * * * * *', () => {
  console.log('Half-minute tick');
});

The 6-field syntax with seconds works in node-cron, but not in standard 5-field cron. Pin to 5-field if you need to port the schedule to other systems.

Pausing and resuming a task

const task = cron.schedule('*/5 * * * *', () => {
  pollExternalApi();
});

// Pause during a maintenance window
task.stop();

// Resume after maintenance
task.start();

// Tear down completely
task.destroy();

Validating an expression before scheduling

if (!cron.validate(userProvidedExpression)) {
  throw new Error(`Invalid cron expression: ${userProvidedExpression}`);
}

cron.schedule(userProvidedExpression, runUserJob);

Use cron.validate when accepting cron expressions from users — invalid input causes node-cron to throw at scheduling time, which is harder to handle than a proactive validation step.

node-cron pitfalls

  • No L / W / # / ? — for last-day-of-month use a runtime check or a different library.
  • Process-bound — when the Node process exits, the schedule stops. For durable scheduling use a queue (BullMQ, Agenda) or a system cron.
  • Single-process — if you horizontally scale your Node app, every replica will fire the cron. Add a leader-election layer or move the schedule to one singleton instance.
  • Long callbacks — node-cron does not serialize concurrent runs. Wrap with a mutex or use maxConcurrency options from a queue library.

Frequently asked questions

What cron syntax does node-cron support?

node-cron accepts 5- or 6-field cron expressions. The 6-field form adds an optional seconds field at the front. Standard wildcards (`*`, `,`, `-`, `/`) are supported. `L`, `W`, `?`, `#` are NOT supported.

How do I set a timezone with node-cron?

Pass `{ timezone: 'America/New_York' }` (or any IANA timezone) as the third argument to `cron.schedule`. Without it, node-cron uses the Node.js process timezone (typically the host's local time).

How do I stop and restart a node-cron task?

`cron.schedule` returns a `ScheduledTask` object with `.stop()` and `.start()` methods. You can also pass `{ scheduled: false }` to create a task that doesn't start firing immediately.

What's the difference between node-cron and cron, croner, cron-parser?

`node-cron` is light, simple, no extra modifiers. `cron` (older package) supports a Quartz-like 6-field form with seconds at the front. `croner` is modern, lightweight, supports `L`. `cron-parser` is parsing-only (no scheduling). Pick based on the cron features you need.

Ready to schedule it?

Point Crontap at any URL. Pick any cron. Done.

WordPress, Shopify, Railway, Cloud Run, Vercel, HubSpot, Ghost, your own box. If it answers HTTP, Crontap can drive it on a clock you can read, in the timezone that actually matters, and page you when something breaks.

Free forever tier ・ No credit card required

Your next schedule
GET/wp-cron.php?doing_wp_cron=1

Schedule

every 5 minutes

Next run

in 23s

Apihustle Logo

This tool is part of the Apihustle suite - a collection of tools to test, improve and get to know your API inside and out.

  • Clobbr logo

    Clobbr

    The app & CLI tool to test API endpoint speed.

    Visit
  • Crontap logo

    Crontap

    Schedule recurring API calls using cron syntax.

    Visit
  • CronTool logo

    CronTool

    Debug multiple cron expressions on a calendar.

    Visit

  • Page AI

    AI Website Generator that designs and writes clean code.

    Visit
  • Shipixen

    Generate customized boilerplates in minutes.

    Visit
  • Page UI

    Landing page UI components for React & Next.js

    Visit