Shift Roster Generator
8 people covering 2 day shifts and 1 night shift for 14 days, with no day shift after a night, at most 5 working days in a row and at least 4 days off each, get a roster where everyone works 5 to 6 days, with 0 rule violations.
How to use
- List the people, one name per line, and pick the first date and the number of days (up to 31).
- Set each shift with the number of people needed every day. Tick "Night" for shifts that count as night work.
- Set the rules: longest run of working days and nights, minimum days off, no day shift after a night, and weekend balance. Add days a person cannot work and pairs who must not be off together.
- Press Generate. Check that the rule check shows 0 violations, read the totals per person, and download the CSV.
How it works
Every person has one value per day: off, or one of the shifts. Each shift must be filled by exactly the number of people you set, and nobody works two shifts on the same day. The tool searches for an assignment that satisfies every rule at once.
The search is a constraint solver. It always fills the cell with the fewest options left first, removes options that a choice rules out for other cells (a night shift removes the day shift for that person the next day, a full shift removes it for everyone else that day), and backs up when a cell runs out of options. Choices are ordered so that people with fewer shifts so far are tried first.
Fairness comes in two steps. First the solver tries to cap every person at the rounded-up average number of working days. Then a local search swaps shifts between two people on the same day, or on two days at once, and keeps a swap only if all rules still hold and the spread of working days, night shifts and weekend shifts does not grow. Weekends are Saturday and Sunday.
A separate checker re-reads the finished table and tests every rule again. The violation count shown is the output of that checker, not of the solver. If no roster exists, the tool relaxes the rules one at a time and reports which ones, once removed, make a roster possible. Simple impossibilities such as too few people on a day are named directly.
The solver is limited to about two seconds. A tight but possible problem can run out of time and report that instead of an answer. Loosening one rule, or pressing Generate again (it uses a new random seed), usually helps. Rules are checked inside the period only: the day before the first date and the day after the last are treated as off.
FAQ
What does "no day shift after a night" do?
If a person works a night shift, the next day they may be off or work another night shift, but not a shift that is not marked as night. Tick "Night" on every shift that should trigger this rest rule.
Why does it say no roster exists?
The rules together leave no valid assignment. The message names the rules that matter: when removing one of them makes a roster possible it is listed, and obvious cases such as needing more people than you have, or days off that cannot fit, are named directly.
How is a fair roster defined here?
The number of working days per person differs by at most one when the rules allow it, and night shifts and weekend shifts are spread as evenly as the solver can manage. Weekend balance is optional and can be switched off.
How do I enter days a person cannot work?
One person per line: a name, a colon, then day numbers, ranges or dates, for example "Ava: 3, 5-7, 2026-11-20". Day 1 is the first date.
What are pairs that must not be off together?
Two people, such as a trainer and a trainee or the only two who can open the shop, of whom at least one must work every day. Enter one pair per line, separated by a comma.
Does it handle part-time hours, skills or shift lengths?
No. Every person is treated the same and every shift counts as one. Mark people with fewer days as unavailable on the days they cannot work, or build separate rosters for separate teams.