Skip to content
πŸ› οΈToolsShed

Intermittent Fasting Calculator

Plan your intermittent fasting schedule with popular methods.

8h
Eating Window
Eat from 12:00 PM
16h
Fasting
Fast starts 8:00 PM
12:00 PM
Eat from
8:00 PM
Stop eating at

Tips

β€’Drink water, black coffee, or plain tea during fasting.

β€’Break your fast with a balanced, nutritious meal.

β€’Consistency is key β€” same schedule daily works best.

About this tool

Intermittent Fasting Calculator helps you plan a sustainable fasting schedule using popular methods like 16:8, 5:2, Eat Stop Eat, and others. Intermittent fasting is an eating pattern that cycles between periods of eating and fasting, and many people use it as a tool for weight management, mental clarity, and overall health. This tool calculates when your eating and fasting windows occur based on your chosen method, making it easy to track your schedule.

Select your preferred fasting method, enter your daily routine (wake time, preferred eating window, or target fasting duration), and the calculator shows exactly when you should eat and when you should fast. You can view your fasting schedule for the next week or month to plan meals ahead. It works with any timezone and accounts for rest days if your chosen method requires them.

Remember that intermittent fasting is not suitable for everyone β€” pregnant women, those with a history of eating disorders, people with certain medical conditions, and individuals taking specific medications should consult a healthcare provider before starting. Start slowly, stay hydrated during fasting windows, and listen to your body; consistency and patience are more important than perfection.

Frequently Asked Questions

Code Implementation

from datetime import datetime, timedelta

def calculate_fasting_window(start_time_str: str, fasting_hours: int) -> dict:
    """
    Calculate fasting and eating windows for intermittent fasting.
    start_time_str: when the fast started, e.g. "2025-03-20 20:00"
    fasting_hours: duration of fast in hours (e.g. 16 for 16:8)
    """
    fmt = "%Y-%m-%d %H:%M"
    fast_start = datetime.strptime(start_time_str, fmt)
    fast_end = fast_start + timedelta(hours=fasting_hours)
    eating_hours = 24 - fasting_hours
    eating_end = fast_end + timedelta(hours=eating_hours)

    now = datetime.now()
    elapsed = (now - fast_start).total_seconds() / 3600
    remaining = max(0, fasting_hours - elapsed)

    return {
        "fast_start": fast_start.strftime(fmt),
        "fast_end": fast_end.strftime(fmt),
        "eating_window_end": eating_end.strftime(fmt),
        "hours_elapsed": round(elapsed, 2),
        "hours_remaining": round(remaining, 2),
        "protocol": f"{fasting_hours}:{eating_hours}",
    }

result = calculate_fasting_window("2025-03-20 20:00", 16)
print(f"Protocol          : {result['protocol']}")
print(f"Fast Start        : {result['fast_start']}")
print(f"Fast End          : {result['fast_end']}")
print(f"Eating Window End : {result['eating_window_end']}")
print(f"Hours Elapsed     : {result['hours_elapsed']}")
print(f"Hours Remaining   : {result['hours_remaining']}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.