…is about 4 hours.
The data vary, but for a medium-sized adult you can probably expect half of the caffeine from that 3pm cup of coffee to still be doing half of its thing about 7pm, 4 hours later. Apparently smokers deal with caffeine quicker and caffeine sticks around in children much longer.
You can expect about 10 minutes before it first kicks-in which, I suppose, is why if you’re feeling tired while driving it’s a decent plan to take a break and drink a coffee, then have a 15 minute nap. See tiredness can kill sketchplanation. Once it starts to kick-in you might hit peak caffeine any time from 45 minutes to 2 hours later.
Caveat: that chart visualisation is extrapolated from reported data, so the shape is approximate only.
Some references say longer, and some say, from 3-9 hours or so. My source which seemed pretty comprehensive was:
Bertil B. Fredholm, Karl Bättig, Janet Holmén, Astrid Nehlig and Edwin E. Zvartau, Actions of Caffeine in the Brain with Special Reference to Factors That Contribute to Its Widespread Use, Pharmacological Reviews March 1999, 51 (1) 83-133;