<prompt> Human: Hi rpersonalfinance,I check this sub everyday, and am a longtime lurker though I may have posted here once before.I am 24 and have endeavors to retire around 5055. With a fairly strict budget I have about 1,150month to either pay off student loans or invest for retirement. I have a 3 month emergency fund.I have been out of school and working full time for about a year and half and at the beginning I had always thought I should pay off loans first and then invest for retirement. However, after digging a little more into the issue I believed the best course of action was to do both as my student loans were between 4-5 interest.I have 48,089.05 in student loans at a 4.84 interest rate. My current course of action is that I would pay 650month towards my student loans including 300 min. payment and invest 500 within my 401k.As I just recently started saving for retirement, my account only sits at 400, but then I began some scenarios.1. Through unbury.me, if I paid 650 a month to my student loans, it would take 7 years and 4 months where I would be paying a total of 56,542.80 including 8,453.75 interestUsing a compounding calculator, at 500 a month with the 400 in my account already, I would be investing 6000 a year and using a 6 average return for the 7 years I would have 53,486.26 within my account at the end of my loans.Using this exact amount and then taking the 650 I had been using on my loans I would be investing 1150month for the next 19 years to 50 and using a 6 average return I would have 657,181.96 within my account.2. If I paid 1150 a month to my student loans it would take 4 years where I would be paying a total of 52,438.34 including 4,349.29 in interest.Using a compounding calculator, at 1,150 a month I would investing 13,800 a year for the next 23 years to 50 and using a 6 average return I would have 688,982.87 within my account.My question is if this math is correct? I had always thought that finding a middle ground in my loans and retirement that I would end up with more at the end of it all due to the 6 vs 4.84 interest, it seems like the latter is more worthwhile however. With any case, under these circumstance if there is another option could anyone please lead me in the right direction to maximize NW at 50? Thank you all!  <response>: Hi OP, I just wanted to comment since I was in your shoes about 10-11 years ago. I had 90k in student loan debt from grad school in 2007. I elected to do both, pay off my loans AND contribute to my companys 401k in the beginning just enough to get the match, later I upped it to 10, then 15 as well as contribute to a Roth IRA. My budget was very tight! But I paid off all my loans in just under 10 years I paid off the highest interest loans first and now 10yrs later I have 2.6x my annual salary in retirement accounts. 