Conway's Doomsday Algorithm

The Doomsday algorithm, devised by the mathematician John Horton Conway, finds the weekday of any date by mental arithmetic. This page explains everything you need, and lets you practise it.

The idea

In every year, a set of easy-to-remember dates all fall on the same weekday, the year's doomsday: 4 April, 6 June, 8 August, 10 October and 12 December, among others (see the table below). In 2025 they are all Fridays, in 2026 all Saturdays. Once you know a year's doomsday, any date is a short count away from the nearest of these dates, and dates 7, 14, 21 or 28 days apart share their weekday.

Weekdays are numbered from Sunday = 0 to Saturday = 6, and all arithmetic is mod 7. A year is a leap year if it is divisible by 4, except for years divisible by 100 but not by 400: 1900 is not a leap year, 2000 is.

The steps

Write the year as 100C + y with 0 ≤ y ≤ 99, so 1995 has C = 19 and y = 95.

  1. Century anchor. The doomsday of year 100C (see the table) is
    A=(5 (Cmod4) + 2)mod7.
    From one century to the next, the 100 years and their 24 leap days shift it by 100 + 24 = 124 ≡ 5, or by 6 when the new century begins with a leap year like 2000. 400 years are exactly 20,871 weeks, so the anchors repeat with period 4 in C.
  2. Year. Since 365 ≡ 1, each year shifts the doomsday by one weekday and a leap year by two, so the y years since 100C shift it by y + ⌊y/4⌋. To keep the numbers small, split y into dozens:
    a=⌊y12⌋,b=ymod12,c=⌊b4⌋.
    Each dozen contributes 12 + 3 = 15 ≡ 1, hence
    y + ⌊y4⌋≡a + b + c(mod 7).
  3. The year's doomsday is
    D=(A + a + b + c)mod7.
  4. Month. With d the day of the date and d0 the day of the month's doomsday from the table (in January and February depending on whether it is a leap year), the weekday is
    w=(D + d − d0)mod7.
Reference tables
The only part of this you need to memorize — everything else is arithmetic.

Weekday numbers

0Sunday “Noneday”
1Monday “Oneday”
2Tuesday “Twosday”
3Wednesday “Treblesday”
4Thursday “Foursday”
5Friday “Fiveday”
6Saturday “Six-a-day”

Conway's own mnemonic is in quotes.

Century anchors

1800–1899Friday (5)
1900–1999Wednesday (3)
2000–2099Tuesday (2)
2100–2199Sunday (0)

Repeats every 400 years: the 2200s are like the 1800s, the 2300s like the 1900s.

Month doomsdays

Jan3 Jan · leap year: 4 Jan
Feb28 Feb · leap year: 29 Feb
Mar14 Mar
Apr4 Apr
May9 May
Jun6 Jun
Jul11 Jul
Aug8 Aug
Sep5 Sep
Oct10 Oct
Nov7 Nov
Dec12 Dec

Even months: 4 Apr, 6 Jun, 8 Aug, 10 Oct, 12 Dec (day = month). “I work 9-to-5 at 7-Eleven”: 9 May and 5 Sep, 11 Jul and 7 Nov. 14 Mar is Pi Day (3/14). January: the 3rd, or the 4th in leap years. February: its last day.

Worked example: 17 May 1995
1995=100 · 19 + 95C = 19, y = 95A=(5 (19mod4) + 2)mod7 = 3doomsdays in 1900 are Wednesdaysa=⌊9512⌋ = 7b=95mod12 = 11c=⌊114⌋ = 2D=(3 + 7 + 11 + 2)mod7 = 2every doomsday in 1995 is a Tuesdayd0=99 May is a doomsdayw=(2 + 17 − 9)mod7 = 317 May is 8 days after 9 May: Wednesday
Worked example: 1 Jan 2000
A leap year despite ending in 00, and a date before the month's doomsday.
2000=100 · 20 + 0C = 20, y = 0A=(5 (20mod4) + 2)mod7 = 2doomsdays in 2000 are Tuesdaysa=⌊012⌋ = 0b=0mod12 = 0c=⌊04⌋ = 0D=(2 + 0 + 0 + 0)mod7 = 2every doomsday in 2000 is a Tuesdayd0=42000 is a leap year, so 4 Janw=(2 + 1 − 4)mod7 = 61 Jan is 3 days before 4 Jan: Saturday

With practice, these steps can be performed very quickly in your head. Use Practice mode to work through examples with the tables and full explanation visible, then switch to Game mode to test yourself against the clock. In either mode you can press a weekday's number, 0–6, on your keyboard to answer instantly. Some dates are historical, and you'll see what happened on them.