{
  "id": "fasting",
  "version": "25f6cd75fffc",
  "status": "published",
  "name": "Fasting Calculator",
  "question": "When does my fast end?",
  "summary": "Works out when a fast ends from its start time and length, and for daily intermittent fasting such as 16:8 the eating window that follows.",
  "category": "health",
  "subcategory": "nutrition",
  "url": "https://www.acalculator.org/health/fasting-calculator",
  "markdown": "https://www.acalculator.org/health/fasting-calculator.md",
  "kind": "function",
  "method": "End = start date and time + fast length (rounded to the nearest minute); for a fast under 24 hours, eating window = 24 − fast length, closing 24 hours after the fast started.",
  "assumptions": [
    "Times are clock times on the calendar with no time zone or daylight saving change during the fast.",
    "A daily plan such as 16:8 repeats every 24 hours: fast for 16 hours, then eat within 8.",
    "This is a timing tool, not medical advice. Ask a health care provider before fasting if you are pregnant, have diabetes, take medicines, or have had an eating disorder."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "date": {
        "title": "Fast starts on",
        "description": "The date of your last meal before the fast. Today, unless you change it.",
        "type": "string",
        "format": "date"
      },
      "time": {
        "title": "At",
        "description": "The time you finish your last meal, when the fast starts.",
        "type": "string",
        "pattern": "^\\d{2}:\\d{2}(:\\d{2})?$"
      },
      "hours": {
        "title": "Fast length (hours)",
        "description": "How many hours to fast: 16 for 16:8, 18 for 18:6, 24 for a whole day.",
        "type": "number",
        "minimum": 1,
        "maximum": 168
      }
    }
  },
  "outputs": {
    "end": {
      "label": "Your fast ends",
      "description": "The date and time the fast ends: the start plus the fast length, to the nearest minute.",
      "format": "text"
    },
    "endDate": {
      "label": "End date",
      "description": "The date the fast ends.",
      "format": "date"
    },
    "endTime": {
      "label": "End time",
      "description": "The time the fast ends.",
      "format": "time"
    },
    "window": {
      "label": "Eating window",
      "description": "For a daily fast under 24 hours: the hours left in the day to eat, 24 − the fast length.",
      "format": "text"
    },
    "windowEnds": {
      "label": "Eating window closes",
      "description": "For a daily fast under 24 hours: when the next fast starts, 24 hours after this one started.",
      "format": "text"
    },
    "minutes": {
      "label": "Fast length in minutes",
      "description": "The fast length in whole minutes, halves rounded up.",
      "format": "integer"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "date": "2026-09-30",
      "time": "20:00",
      "hours": 16
    },
    "outputs": {
      "end": "Thursday, October 1, 2026, 12:00 PM",
      "endDate": "2026-10-01",
      "endTime": "12:00",
      "window": "8 hours",
      "windowEnds": "Thursday, October 1, 2026, 8:00 PM",
      "minutes": 960
    },
    "text": "A 16-hour fast that starts at 8:00 PM on September 30, 2026 ends on Thursday, October 1, 2026, 12:00 PM."
  },
  "examples": [
    {
      "given": {
        "date": "2026-09-29",
        "time": "20:00",
        "hours": 16
      },
      "expect": {
        "end": "Wednesday, September 30, 2026, 12:00 PM",
        "endDate": "2026-09-30",
        "endTime": "12:00",
        "window": "8 hours",
        "windowEnds": "Wednesday, September 30, 2026, 8:00 PM",
        "minutes": 960
      },
      "source": "Clock arithmetic with 1 h = 60 min and 1 d = 24 h (NIST SP 811): 8:00 PM + 16 hours = 12:00 PM the next day; the eating window is 24 − 16 = 8 hours"
    },
    {
      "given": {
        "date": "2026-12-31",
        "time": "18:30",
        "hours": 18.5
      },
      "expect": {
        "endDate": "2027-01-01",
        "endTime": "13:00",
        "window": "5 h 30 min",
        "minutes": 1110
      },
      "source": "Clock arithmetic: 6:30 PM + 18 h 30 min = 1:00 PM on January 1; hand calculation in content.mdx"
    },
    {
      "given": {
        "date": "2026-10-05",
        "time": "19:00",
        "hours": 36
      },
      "expect": {
        "end": "Wednesday, October 7, 2026, 7:00 AM",
        "minutes": 2160
      },
      "source": "Clock arithmetic: 7:00 PM Monday + 36 hours = 7:00 AM Wednesday"
    }
  ],
  "sources": [
    "de Cabo R, Mattson MP. Effects of Intermittent Fasting on Health, Aging, and Disease. N Engl J Med. 2019;381(26):2541-2551 (describes daily time-restricted feeding such as 16:8). https://doi.org/10.1056/NEJMra1905136",
    "National Institute of Standards and Technology. Guide for the Use of the International System of Units (SI), NIST Special Publication 811 (1 h = 60 min, 1 d = 24 h). https://www.nist.gov/pml/special-publication-811"
  ],
  "related": [
    "calorie-deficit",
    "weight-loss",
    "water-intake"
  ],
  "changelog": []
}
