Guides

How to build a school timetable that does not clash

Write the allocation down as class, subject, teacher and periods a week; check that no teacher and no class is asked for more periods than the week actually has; then place the fixed lessons and let the rest be arranged — and when something will not fit, the arithmetic almost always said so before the solver did.

12 min read · 8 steps · 6 ways it goes wrong

What you need before you start

  • The shape of the week: which days, how many periods a day, where the breaks fall, and whether any day is short.
  • The allocation: for every class, every subject it takes, who teaches it and how many periods a week it gets. This is the real work and no tool can do it for you.
  • Which of those periods have to be doubles, and whether a double may straddle a break.
  • The genuine constraints: teachers who are not in on particular days, lessons pinned to a fixed slot such as assembly or games, and rooms that only one class can use at a time.
  • One person with the authority to change the allocation. Almost every timetable that will not fit is fixed by changing the allocation, and if nobody can do that the exercise stalls.

Fix the shape of the week first

Days, periods per day, and where the breaks sit. Count the total slots available to a class: days multiplied by periods. That number is the budget every class spends and it does not change because somebody wants an extra history lesson.

If Saturday is a half day, or one day has an extra period, say so now. A week that is not uniform is perfectly manageable, and a week that is described as uniform when it is not produces a timetable that cannot be printed.

Write the allocation as a plain table

One row per class, subject and teacher, with the periods a week and the number of those that must be doubles. Nothing else.

  • Class — exactly as it will be printed, and spelled the same way every time.
  • Subject.
  • Teacher — one name per person, spelled identically in every row. This matters more than anything else on the sheet.
  • Periods a week.
  • Doubles, if any.
  • Room, if you want it on the grid.

The tool for this step: School Timetable Generator — takes that allocation and produces a clash-free grid for every class and every teacher, keeps doubles adjacent, honours unavailable days and lists anything that would not fit.

Do the arithmetic before you run anything

Two sums decide whether a timetable can exist at all, and both can be done in a spreadsheet in a minute. They are worth doing first because a solver that fails tells you it failed, while these tell you why.

for each class: total periods allocated ≤ days × periods per day

for each teacher: total periods taught ≤ available slots, after days off and daily maximums

If a teacher is allocated forty-two periods in a forty-period week, no arrangement exists. Not a difficult one — none. The same is true of a class allocated forty-one periods of a forty-period week. This is the commonest reason a timetable "cannot be built", and it is arithmetic rather than bad luck.

Take days off out of the teacher’s side before you compare. A teacher who is not in on Wednesdays has lost a fifth of their slots, and a daily maximum of five in a six-period day removes a sixth more.

Understand the impossibilities the two sums do not catch

Both totals can pass and the timetable can still be impossible, because the constraint is not on the totals but on the overlap.

  • Two classes that need the same specialist, where the only periods either class has free are the same periods. Each is individually fine; together they need one person in two rooms.
  • A double period that cannot straddle a break. In a six-period day with a break after the third period, a double can only start in four places, not five — and if the lesson also has to avoid the last period, in three.
  • A subject that must not appear twice on the same day, allocated more periods a week than there are days.
  • A part-time teacher whose two days carry more periods than two days hold.
  • Fixed lessons that overlap. Assembly pinned for every class at the same time is fine; a games period pinned for two classes with one field is not.

These are all pigeonhole problems: more things than places to put them, once you look at the right set of places rather than at the week as a whole.

Add the constraints that are actually hard, and only those

Separate the rules from the preferences, in writing, before anybody starts arranging. A hard rule is one that makes a timetable invalid: a teacher who is genuinely not in, a lesson that is genuinely pinned. A preference is everything else — spreading a subject through the week, keeping a teacher’s free periods together, no double mathematics on a Friday afternoon.

Preferences submitted as rules are the second commonest reason a timetable will not fit, and the hardest to argue about afterwards, because by then they are written down as constraints and look official.

Arrange it, then read what did not fit

Arranging is a search, not a formula: it places the most constrained lessons first, backtracks when it gets stuck, and tries again from a different starting point. Expect a handful of attempts, and expect two runs to produce two different but equally valid timetables.

What matters is the list of anything unplaced. A good unplaced list names the class, the subject, the teacher, how many periods did not fit, and the most likely reason — which is usually one of the capacity sums from the step above, already worked out for you. "No free slot where both the class and the teacher are free" means the overlap problem rather than the total.

Nothing should be silently dropped. A timetable with one lesson quietly missing is worse than one that failed loudly, because it will be printed, distributed, and discovered in week two.

Fix an impossible allocation at the allocation

  1. Split the subject between two teachers. One class, two teachers, three periods each — this is what to do when one specialist is over capacity.
  2. Move a period to another subject or drop it. If the class budget is over, something has to go.
  3. Relax a daily maximum, or buy back a day off. Both have a cost outside the timetable and both are decisions for somebody senior.
  4. Unpin a fixed lesson. A games period pinned on Tuesday because it has always been on Tuesday is often the single constraint making everything else impossible.
  5. Change the shape of the week. A last resort, and occasionally the right answer.

What does not work is running the arranger again and hoping. If the arithmetic says no arrangement exists, no number of attempts will find one.

Check it from the other end before you print it

Produce the teacher grids as well as the class grids and read them. A class grid can look perfect while a teacher grid shows somebody teaching a double on both sides of lunch every day of the week.

  • No teacher in two places at once, and no class with two lessons at once.
  • Every allocated period actually appears, the right number of times.
  • Doubles are adjacent and on the same side of a break.
  • Unavailable days are empty.
  • Every teacher’s day is humane: the arranger optimises for validity, and a valid timetable can still be exhausting.

Then print the class grids for the noticeboard and the teacher grids for the staffroom, and keep the allocation file — next year starts from it.

Where this usually goes wrong

6 things that actually happen, rather than a note asking you to be careful.

  • One teacher, spelled two ways. Write "R. Sharma" in nine rows and "Sharma R" in three and there are now two teachers, each with a manageable load, and the clash you were trying to prevent appears on the printed grid in week one. Nothing in the arithmetic will catch it, because both of the imaginary teachers pass every capacity check comfortably. Before anything else, list the distinct teacher names from the allocation and count them. If the count is higher than the staff room, you have found it. The same applies to class names, where "6 A" and "6A" are two different classes.
  • Preferences written down as rules. A teacher who would rather not teach last period on Friday, entered as an unavailability, is indistinguishable from a teacher who is not in the building. Collect twenty of those and the timetable becomes genuinely impossible, and the impossibility is reported as a capacity failure on a teacher who is, in fact, available. Keep two lists — cannot and would rather not — and only the first goes in as a constraint. The second is what you satisfy with whatever freedom is left, and it is what a good arrangement gives you for nothing.
  • Counting the week without the things that are not lessons. Assembly, games, library, club period and the house meeting all occupy slots, and none of them normally appears in a subject allocation. A class budget worked out against the full week is therefore too generous by exactly those periods, and everything fits on paper and not in reality. Either pin them as fixed lessons so they consume their slots honestly, or subtract them from the week before you allocate. Pinning them is better, because then they appear on the printed grid where the pupils can see them.
  • The room nobody modelled. A timetable that has no notion of rooms will happily give two classes science at the same time when there is one laboratory, or three classes games with one field. The room column on an allocation is usually a label printed on the grid rather than a constraint that is enforced, and it is easy to assume otherwise because the room is right there on the sheet. Where a room is genuinely scarce, model it as a teacher: a single imaginary member of staff called "Lab" who cannot be in two places at once will not let two classes use it, and the capacity sums then apply to it like anybody else.
  • Doubles that do not fit where doubles can go. A double period needs two adjacent slots on the same side of a break, which is a much smaller set of positions than "any two periods". In a day split by a break, a double cannot start in the slot before it. Ask for more doubles in a subject than the week has weekly periods and the request is simply contradictory; ask for four doubles across five days in a week whose breaks leave three legal starting positions a day and it is merely very hard. The unplaced list will name the subject, and the fix is nearly always to convert one double back into two singles.
  • Expecting the same timetable twice. Arranging a timetable is a randomised search that keeps the best result it finds within the time it has. Run it twice on the same allocation and you will get two different timetables, both valid. That is fine until somebody prints Tuesday from one run and Wednesday from another, or checks a printed copy against a re-run and reports a fault that is not there. Generate once, export everything from that one run — class grids, teacher grids, the unplaced list — and treat those files as the timetable rather than treating the tool as the timetable.

How long this should take

Two days in August for a school doing it properly for the first time, and almost all of that is the allocation — deciding who teaches what, and negotiating the three subjects that want the same specialist. The arranging itself is minutes. In following years it is an afternoon, because last year’s allocation is the starting point and only the changes need arguing about.

Frequently asked questions

Why did some lessons not fit?

Almost always arithmetic rather than bad luck. Add up one teacher’s periods a week and compare them against the slots available after days off and daily maximums; do the same for the class against the size of the week. The unplaced list names the class, subject and teacher, and the capacity summary usually shows the cause in one line.

Can it handle part-time teachers and days off?

Yes — an unavailable day is a hard constraint and is left empty. What it cannot do is invent capacity: a part-time teacher whose available days do not hold the periods allocated to them will produce an unplaced list, correctly.

Does it schedule rooms?

A room can be shown on the grid, but a scarce room is not enforced as a constraint. Where one laboratory has to be shared, model it as a teacher who cannot be in two places at once; the same capacity arithmetic then applies to it.

Is any of this uploaded?

No. The allocation is read and arranged in your browser and the workbook is written there, so no staff or pupil names leave the machine.

The tools this uses

Each one described in its own words, read from its own page. Everything here runs in your browser unless it says otherwise.

Short lists of tools for this kind of work