You usually need to fast for 8–12 hours before a test. Most tests that require fasting are scheduled for early in the morning. That way, most of your fasting time will be overnight.