If at all possible, I'd put enough into my 401k to get the maximum company match. I don't know what the rules are at your company, but typically the company will match 50% or 100% of what the employee puts in up to some limit. So every dollar you put into a 401k gets an instant, guaranteed 50% to 100% profit. I've never heard of any investment that competes with that. I'd put money into a 401k before I put into any other savings or investment. Except, I suppose, to build up a minimum emergency fund.
My next priority would be building a reasonable emergency fund. And let me say here, I've heard advice on how much you should have in an emergency fund that I think is wildly unrealistic, like "six months gross pay". When I was young, I didn't put anywhere near that much into my emergency fund. I read one explanation for this saying that you need enough to maintain your lifestyle if you lose your job. Well if I lost my job, (a) It probably wouldn't take me 6 months to find another job. The one time I did get fired, it took me 2 months to get another job. Maybe if you're in a field where it's tougher to find a new job a bigger emergency fund would be called for. (b) Why gross pay and not net? If I'm living off my savings, I don't have to pay taxes when I withdraw money from my savings. (c) If I lost my job, I wouldn't blithely continue to spend at the same rate as when I had a steady income. Thus, I think 2 months net pay would be plenty for most people to survive a brief period of unemployment.
What I've really used my emergency fund for in real life has been things like unexpected car repairs, a big medical bill, that sort of thing. In that case comparing to your income isn't the key point, but rather coming up with a plausible amount for likely unexpected expenses. These days I'd probably say $2000 or so.
- Balancing between investing and paying off debts is a complicated question. The stock market typically gives bigger returns than the interest on most debt. So if, say, you have a debt at 5% and the stock market is growing at 7%, mathematically it makes sense to put any extra money in the stock market, and, in principle, collect 7%, use 5% to pay the interest on the debt, and keep the 2% difference. (Of course you probably wouldn't actually withdraw from your investments to pay the interest on a debt while paying the principle on the debt from other income. But in principle you could.)
If you have a debt with higher interest than any available investment, like credit cards, I'd pay those off before adding to investments.
But when the interest on the debt is smaller ... Another way to look at it is, interest on a debt is usually a fixed amount, while investment returns are highly variable. On the average for the past few decades, the stock market has returned 7%. But it certainly has not returned a predictable 7% every year. One year it may go up 15% and the next year down 10%. It's a roller coaster. So it comes down to deciding on average returns versus your tolerance for risk. You may have practical or psychological reasons why you're not willing to take a high risk.
There's also the practicality that it's just convenient if you can pay off a debt. It's one less bill to deal with every month. Getting rid of the bill simplifies your budgeting and eliminates the possibility that you'll make a mistake and forget to pay the bill and get hit with late charges, or have some other problem. Like personally, I have my mortgage down to the point where I owe just $10,000. So I've reduced how much I add to investments and am putting that money toward paying off the mortgage, so I can get it paid off in the next few months and just get rid of it.
In my humble opinion, paying off a student loan would be about the last thing on my priority list. Pay the minimum, of course. But student loans tend to have low interest rates. And, I don't know the terms of your loan, but there are often clauses in the contract that if your income is low you qualify for reduced payments, so these are less of a burden if you did lose your job or some such. Student loans are often extinguished when you die. So if you add $1 to a retirement account, that's money you can leave to your heirs. If you pay off $1 of your student loan, that does nothing to increase the value of your estate, because the debt would be wiped out when you die anyway. Of course all of this depends on the terms of your student loan, but it's worth looking into.
- I keep almost nothing in cash. I typically keep about $3000 in my checking account, and that's probably way too much. I want to keep enough in there so that if I make a mistake I don't accidentally overdraw the account. That's about it. $1,000 is probably plenty for that.
I keep my emergency fund / slush money in a set of very conservative mutual funds. I talked to a broker when I set this up and said I wanted a fund that was unlikely to lose more than 1% in bad years, and of course I understood that that meant it probably didn't make that much in good years. He found me a couple of funds that had rarely lost more than 1% and generally gained maybe 3 or 4%. I considered that perfect. I call this my "savings account" and that's how I think of it. I drained that account when my daughter went to college and then once when it was my turn to bail out my sister.
- In practice these days I use a credit card as my real emergency fund. If I have, say, a car or home repair, I pay with a credit card, and then when the bill comes, instead of adding to my investments I use the money to pay off the credit card. I make enough money these days that it's very rare for me to have to leave a balance on a credit card. For people with tighter finances, having a good emergency fund is more important.