A 401(k) grows from three sources: the money you contribute, the money your employer contributes as a match, and the investment growth on both over time. For a young saver, contributions dominate the early years; for someone within a decade of retirement, growth on the existing balance does most of the work.
Contributions come out of your paycheck before income tax in a traditional 401(k), so a $6,000 annual contribution reduces this year's taxable income by $6,000 — the true cost to your take-home pay is less than the amount saved. The balance then grows tax-deferred, and you pay ordinary income tax only when you withdraw in retirement.