How long should a coding session be?

The answer is not twenty-five minutes, and it is not whatever you can endure.

Most advice about session length starts from the wrong end. It picks a number, attaches a rationale, and leaves you to discover that the number does not fit your work. The useful question is not how long you can concentrate. It is how long it takes you to get started, because that is the cost you pay every time a block begins.

Start-up cost decides everything

Think about what happens in the first minutes of real programming work. You are reloading state: which files matter, what the function you were halfway through was supposed to do, which of four hypotheses about the bug you had already ruled out. None of that is in the editor. It is in your head, and it evaporated when you last stood up.

If that reload takes you two minutes, a twenty-five-minute block is fine: you lose eight percent of it to warm-up. If it takes fifteen minutes, the same block gives you ten minutes of work for fifteen minutes of climbing, and you will end the day convinced you cannot focus when what you actually did was pay a toll five times instead of once.

So the rule is a ratio rather than a duration. Make the block long enough that the start-up cost is a small fraction of it. For code you know well, half an hour. For an unfamiliar codebase or a subtle bug, ninety minutes is not indulgence, it is the first length at which the block is mostly work.

The ceiling is real, but it is further away than people say

There is an upper limit, and it is not mysterious: attention degrades, and the last twenty minutes of a long block are worth less than the first twenty. But the limit is usually discovered rather than scheduled. If you are reliably drifting at the fifty-minute mark, your block is too long. If you are still going cleanly at ninety, stopping on principle because a timer said so is throwing away the expensive part you just paid for.

The exception is the end of a session that is going well, which is the single most common way people wreck the following day. Stopping mid-flow with a clear next step costs you ten good minutes now and saves you fifteen minutes of reload tomorrow. Stopping when you are exhausted and the thread is lost costs you the reload anyway.

What to actually do

Run one week at thirty minutes and one at ninety, on the same kind of work, and look at what you finished rather than how it felt. Feelings about focus are unreliable in a specific direction: short blocks feel productive because they end often, and ending often feels like progress.

Then set the number and stop renegotiating it mid-session. The entire value of deciding a length in advance is that the decision is made by someone who is not yet tired.

More