Day of the Year Calculator
Convert a date to its day-of-year number and back. Get the ISO 8601 ordinal date, days left in the year and the share of the year elapsed.
Day of the Year Calculator
Background.
This calculator converts between a calendar date and its day-of-year number, in both directions. Give it 27 October 2026 and it returns day 300. Give it day 300 of 2026 and it returns 27 October. Alongside the number it reports the ISO 8601 ordinal date form (2026-300), the weekday, how many days are left in that year, and what share of the year has elapsed.
The reverse direction is the reason this page exists as its own tool. Turning a date into a day number is something several calendars will do for you as an aside — including this site's own day of the week calculator, which reports the day-of-year alongside the weekday and the ISO week number. Turning a day number back into a date is the harder half and the one that is usually missing, and it is the half you need when you are reading a data file, a satellite log, a crop-trial sheet or an aviation record where dates were stored as ordinals in the first place.
The ordinal date is not an obscure convention. It is one of the date representations defined by ISO 8601 itself, written YYYY-DDD, where DDD runs from 001 to 365 — or to 366 in a leap year. The standard's own worked example is 1981-04-05, which is 1981-095. POSIX defines the same value as the %j conversion in strftime, described there as 'the day of the year as a decimal number [001,366]'. Fields that work with day-of-year arithmetic constantly — meteorology, agronomy, aviation, spacecraft operations — reach for it because subtracting two ordinals inside the same year is trivial, while subtracting two calendar dates is not.
Two conventions are worth stating plainly before you use the numbers, because getting either one backwards produces an answer that is wrong by exactly one. First, 1 January is day 1, not day 0. The ordinal is a position, not an elapsed count, so it is always one higher than 'days since 1 January'. If you are feeding the number into a system that counts from zero, subtract one. Second, days left in the year counts the days after the given date, so 31 December always shows zero rather than one, and the share of the year elapsed treats the given day as complete, so 31 December is exactly 100%.
Leap years are handled by the full Gregorian rule rather than a shortcut: divisible by four, except century years, except century years divisible by 400. 2024 and 2000 are leap years; 1900 and 2100 are not. That rule decides three things on this page at once — whether 29 February exists, whether the year has a day 366, and where every date after February sits in the count. Ask for day 366 of a common year and the calculator refuses and tells you why, rather than quietly rolling into the next January.
One thing this page deliberately does not do is ISO week numbers. Week numbering is a separate system with a different year boundary — week 1 is the week containing the year's first Thursday, which is why 1 January 2021 belongs to week 53 of 2020 — and the day of the week calculator owns that output. Two pages offering separate opinions on the same tricky boundary is how a catalog starts disagreeing with itself.
What is day of the year calculator?
An ordinal date, sometimes loosely called a Julian date in industry (a different thing from the astronomical Julian Day used for star charts), identifies a day by its year and its position within that year rather than by a month and a day-of-month. ISO 8601 writes it YYYY-DDD: 2026-300 is the 300th day of 2026. The representation has two properties that make it popular in technical work. Arithmetic inside a year is subtraction — day 300 minus day 210 is 90 days, with no month-length table involved. And sorting is lexicographic, so a list of zero-padded ordinal dates sorts into chronological order as plain text. Its limitations are the mirror image: it says nothing about the month, it cannot be compared across years without knowing whether a leap day sits between the two, and the same ordinal points at a different calendar date in a leap year than in a common year — day 60 is 29 February in 2024 and 1 March in 2026.
How to use this calculator.
- Pick the direction. 'Date → day number' takes a calendar date; 'Day number → date' takes a year and an ordinal.
- In 'Date → day number' mode, enter the date as ISO 8601 (YYYY-MM-DD). The year and day-number fields are ignored in this mode.
- In 'Day number → date' mode, enter the year first — it decides whether day 366 exists — then the day number from 1 to 365 or 366.
- Read the answer sentence, then the supporting figures: the ISO ordinal form to paste into a system that expects YYYY-DDD, the weekday, the days left in that year, and the share of the year elapsed.
- If you need the ISO week number as well, use the day of the week calculator — week numbering follows a different year boundary and is deliberately not duplicated here.
The formula.
Forward, the calculation is a subtraction. The date and 1 January of the same year are both converted to UTC-midnight instants, the difference is divided by the number of milliseconds in a day, and one is added because 1 January is day 1 rather than day 0. Anchoring both ends in UTC matters: a naive local-time implementation shifts by an hour at each daylight-saving transition, and an hour lost at midnight becomes a whole day lost in the ordinal.
Reverse, it is the same subtraction rearranged. One is taken off the day number, that many days are added to UTC midnight of 1 January, and the resulting instant is read back as a year, month and day. No month-length table is consulted in either direction — the calendar's own leap-year handling does the work, which is why the century cases (1900 is not a leap year, 2000 is) come out right without a special case.
The supporting figures follow from the two ordinals. The year's length is 366 when the Gregorian rule makes it a leap year and 365 otherwise. Days remaining is that length minus the ordinal, which is zero on 31 December by construction. The share of the year elapsed is the ordinal divided by the year's length, times 100, computed in arbitrary-precision decimal and rounded only at the end — so 27 October 2026, day 300 of 365, gives 82.1917808219%, and 31 December gives exactly 100 rather than 99.99999999999999.
The day-number field is validated against the year rather than against a fixed ceiling of 366. Day 366 of 2024 is 31 December; day 366 of 2026 does not exist, and the calculator says so in those words instead of rolling forward into 1 January 2027, which is what an unchecked implementation would silently do.
A worked example.
Take 27 October 2026. Adding up the months before October — 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 — gives 273 days through the end of September, and 273 + 27 is 300. So 27 October 2026 is day 300 of 2026, written 2026-300 in ISO 8601 ordinal form, and it falls on a Tuesday. 2026 is not a leap year (2026 is not divisible by 4), so the year has 365 days: 365 − 300 leaves 65 days remaining, and 300 ÷ 365 × 100 gives 82.1917808219% of the year elapsed. Run the calculator the other way — day 300 of 2026 — and it returns 27 October 2026 again, which is the round trip the test suite checks for all 365 days of 2026 and all 366 days of 2024. Change the year to 2024 and the same ordinal lands somewhere else entirely: day 300 of 2024 is 26 October, one day earlier on the calendar, because the leap day sits between 1 January and the ordinal.
Frequently asked questions.
Is 1 January day 0 or day 1?
Why does the same day number give a different date in a leap year?
Is this the same thing as a Julian date?
What happens if I ask for day 366 of a year that is not a leap year?
How is 'percent of the year elapsed' defined?
Does the day of the week calculator not already show me this?
Which calendar does this use for very old dates?
References& sources.
- [1]International Organization for Standardization, ISO 8601-1:2019 — Date and time: representations for information interchange, Part 1: Basic rules. Defines the ordinal date representation YYYY-DDD with DDD in 001–365 (001–366 in a leap year); the standard's illustrative example is 1981-04-05 = 1981-095, which this calculator reproduces and asserts in its test suite. Full text is a purchased standard; the abstract and scope are open.
- [2]The Open Group, POSIX.1-2017 Base Specifications (IEEE Std 1003.1-2017) — strftime. Conversion specification %j is 'the day of the year as a decimal number [001,366]' — an open-access confirmation of both the value and its range, independent of the ISO text.
- [3]Internet Engineering Task Force, RFC 3339 — Date and Time on the Internet: Timestamps. The internet profile of ISO 8601; the basis for anchoring every date at UTC so that a daylight-saving transition cannot move a calendar date and therefore cannot move its ordinal.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 977 calculators remain free
- No billing is enabled