As a general rule of thumb, longer endurance events are generally preceded by longer tapering periods, with the curious exception of particularly long endurance competitions, such as ultramarathons and multiday races.
Typically, tapering for relatively short endurance events takes as little as a week or less, but tapering for an event like the marathon takes at least two or three weeks. Bob Cooper, a veteran marathoner and contributing editor for Runner's World, points to medical studies as evidence that the final three weeks of any marathon-training program are the most critical stage of training; a review of fifty studies on tapering indicates that optimal levels of muscle glycogen, enzymes, antioxidants, and hormones, which are significantly depleted by intense endurance training, are achieved during a taper.
Often, a workout simulating the actual race distance and conditions will climax the period of training immediately before tapering. "The taper should be preceded by your last long run", according to two-time American Olympian Pete Pfitzinger.