Why week numbers confuse developers and planners alike
Week numbering seems simple until you encounter the edge cases. The first week of January often belongs to the previous year's last week, and the last days of December can fall into week 01 of the following year. This happens because the ISO 8601 standard defines week 01 as the week containing the year's first Thursday — a rule that creates counterintuitive results around year boundaries. For example, January 1, 2025 is a Wednesday, so it falls in week 01 of 2025, but December 31, 2025 is a Wednesday and falls in week 01 of 2026.
This year-boundary behavior is not a quirk; it is a deliberate design choice in ISO 8601 that ensures every week belongs to exactly one year and every ISO year has either 52 or 53 complete weeks. The alternative — starting week 01 on January 1 regardless of the weekday — would produce weeks that straddle two calendar years and weeks with fewer than seven days. ISO 8601 avoids both problems, but the trade-off is that the 'week-year' can differ from the calendar year for dates near January 1 and December 31.
For software developers, getting week numbers wrong causes bugs in weekly reports, payroll processing, shipment scheduling, and any system that aggregates data by week. The JavaScript `Date` object does not natively provide ISO week numbers, which is why a dedicated implementation is needed. This tool uses the standard algorithm — find the Thursday of the ISO week, then count days from January 1 — to compute the correct week number for any date.
ISO 8601 week rules at a glance
| Rule | Detail |
|---|---|
| Week starts on | Monday |
| Week ends on | Sunday |
| Week 01 contains | First Thursday of the year |
| Equivalently | January 4 is always in week 01 |
| Week range | 01–53 |
| Long years (53 weeks) | Years starting on Thursday, or leap years starting on Wednesday |
How to find the week number for any date
The top card displays the current ISO week number, updating live every second based on your device's system clock. No interaction needed — just open the tool and see this week's number.
Use the date picker in the bottom card to select any past or future date. The tool immediately computes and displays that date's ISO week number, week-year, day-of-year, and the Monday-through-Sunday range of the week.
Note the week-year field, which may differ from the calendar year for dates in early January or late December. This is correct per ISO 8601 and not a bug.
Click the Copy button on either card to copy the week number in 'Www/yyyy' format (for example, W23/2025) for use in reports, file names, or project planning.
Use the 'Today' button to snap the date picker back to the current date if you have been browsing other dates.
Understanding week-year divergence
The week-year diverges from the calendar year when a date's ISO week number belongs to a different year than the date itself. This occurs for 1-3 days at the start of January and 1-3 days at the end of December in most years. The pattern depends on which day of the week January 1 falls on. If January 1 is a Friday, Saturday, or Sunday, those days belong to the last week of the previous year. If December 31 is a Monday, Tuesday, or Wednesday, those days belong to week 01 of the following year.
A concrete example: December 29, 30, and 31, 2025 are Monday, Tuesday, and Wednesday. The Thursday of that week is January 1, 2026, which is the first Thursday of 2026. Therefore, all three December days fall in ISO week 01 of 2026, not in week 52 or 53 of 2025. The tool correctly reflects this by showing week-year 2026 for those dates.
Common mistakes
Assuming week 01 always starts on January 1: in many years, the first few days of January belong to week 52 or 53 of the previous year. Always check the ISO week number rather than guessing.
Using Sunday as the week start: ISO 8601 defines Monday as the first day of the week. Systems that start weeks on Sunday (common in the US) will produce different week numbers.
Ignoring 53-week years: most years have 52 weeks, but years that start on Thursday (or leap years that start on Wednesday) have 53 weeks. Failing to account for this causes off-by-one errors in year-end processing.
Trusting JavaScript's `getDay()` for ISO week calculations: `getDay()` returns 0 for Sunday, while ISO weeks start on Monday. Naive implementations using `getDay()` directly produce incorrect week numbers.
The algorithm behind the calculation
The ISO week number is computed by finding the Thursday of the target date's week. Thursday is used because it is the middle day of the ISO week (Monday through Sunday), and by definition, the Thursday of week 01 falls in January. The algorithm adjusts the target date to the Thursday of its week, then calculates the ordinal day of the year for that Thursday, divides by 7, and adds 1 to get the week number.
Specifically, the tool computes `thursday = date + 4 - (date.getDay() + 6) % 7` (where `getDay()` is adjusted so Monday = 0), then calculates `yearStart = new Date(thursday.getFullYear(), 0, 1)`, and finally `weekNumber = Math.ceil(((thursday - yearStart) / 86400000 + 1) / 7)`. The division by 86400000 converts milliseconds to days. This approach works correctly for all dates without requiring lookup tables or external libraries.
Real-world use cases
Naming weekly report files using the ISO week number (for example, `report-W23-2025.pdf`) to ensure consistent, chronological sorting across years and to avoid confusion about which week a report covers.
Planning sprints in agile project management where sprints are numbered by ISO week, making it easy to map any date to its corresponding sprint without maintaining a separate sprint calendar.
Calculating deadlines expressed in weeks: if a contract requires delivery 'within 6 weeks' of a given date, converting the date to its ISO week number and adding 6 gives the delivery week number directly.
Coordinating international teams where different countries use different week numbering systems, using ISO 8601 as the shared standard to avoid miscommunication.
Frequently asked questions
Q: What is an ISO week number?
A: ISO 8601 defines weeks as Monday-to-Sunday. Week 1 is the week containing the year's first Thursday (equivalently, 4 January). Week numbers run 01–53.
Q: Why might the week-year differ from the calendar year?
A: For dates near 1 January or 31 December, the ISO week-year can differ from the calendar year. For example, 31 December 2024 falls in ISO week 01 of 2025.
Q: Does this tool use a lookup table?
A: No — the ISO week is computed from scratch using the standard algorithm (find the Thursday of the ISO week, then count days from 1 January).
Q: Is the live week accurate while my tab is open?
A: Yes. It updates every second using your device clock. If your system clock is wrong, the displayed week will be wrong too — fix it in your OS settings.
Q: Can I copy the week number?
A: Yes. Each card has a Copy button that copies the value in 'Www/yyyy' format.
Q: How does this differ from US week numbering?
A: US convention often starts weeks on Sunday and numbers them differently. ISO 8601 always starts on Monday and uses the first-Thursday rule, which is the international standard.
Get your week number now
Use the Week Number Calculator to find the ISO week for any date. For related calendar tools, see Multi-Calendar Converter, Workday Calculator, or Calendar Generator.