What tax year do straddled 401k contributions actually count for?
Hi all - long time lurker, first time poster. I please need some help figuring out the nuances of when 401k contributions count for which tax years for pay periods that straddle tax years. Mainly because I'm really confused about how to ensure I don't max over my limit, as I'm in the very lucky position to be able to max this year for the first time ever. I've read a lot on this and cannot for the life of me find an authoritative source, so if you are able to please link a source too or tell me where to look, I'd be super grateful!
Example A: if a biweekly pay period were to straddle years (e.g., some days worked for that pay period were in December 2025 and some were in January 2026), then what tax year (2025 or 2026) do those 401k contributions count for? And what is the determinant for which year they count for - the official pay date? the actual hit-the-bank pay date? or the year in which the days were worked?
Example B: just to make sure I fully understand this - what happens if all the days worked were in 2025 but the official pay date on the pay stub was in 2026?
Thank you so much for any help in figuring out this thing that has hurt my brain for days!