The formula, and why the frequency matters
A lump sum compounds as balance × (1 + rate/periods)^periods. At a 7% nominal rate compounded monthly, the effective rate is 7.229% a year; compounded daily it is slightly higher still, and compounded annually it is exactly 7%. The headline rate is therefore never quite what you earn unless compounding happens once a year, which is why this page prints the effective annual rate separately.
Deposits compound as an annuity: each one earns interest for the number of periods it is invested. A deposit at the start of a period earns one period more than the same deposit at the end, which is the difference between an annuity due and an ordinary annuity - and the reason the deposit timing toggle exists. The calculation works period by period rather than with a closed form, so that timing lands exactly.