You know the advice: Save up to six months’ worth of living expenses in an emergency fund. With that kind of financial reserve built up, an unexpected curveball, like a car repair or a job layoff, won’t send you reeling. But exactly how many months of savings do you need? And what if your student loan payment feels way more pressing?

“A big part of deciding how much to save is knowing your own comfort level,” says Sophia Bera, CFP, founder of Gen Y Planning. And you have to consider your savings in the bigger picture of your finances, including how stable your income is, whether you’re single or part of a two-income household, and how fixed your expenses are.

The only two requirements that aren’t negotiable? “Your emergency funds need to be safe and liquid,” says Nic Nielsen, CFP, financial advisor at SunTrust Investment Services. In other words, you need to be able to get your hands on the money ASAP when disaster (or just a flat tire) strikes. To fine-tune your savings target, consider these scenarios:

If: You’ve got a ton of debt
Do this: Scale back your savings goal

“I’m not a huge fan of having $20,000 on the sidelines in a savings account earning 1 percent interest, when you could apply $15,000 of that toward student loans that are costing you 7 percent interest or more,” says Bera. For people comfortable having less cushion in the bank (or who feel like their credit card bill is giving them an ulcer), she recommends targeting just three months of savings and apply everything else toward paying down debt.

If: You’re responsible with your credit card
Do this: Look at online savings accounts

Online accounts sometimes pay higher interest than traditional brick-and-mortar banks. The drawback? You might have to wait days from requesting a withdrawal to actually having the money in hand, or you might face withdrawal limits. But if you have access to credit, you can stash your savings in an online account without worrying about the delay. “If something comes up, you can put that $500 fee on your credit card, then transfer your savings from the online account and immediately pay off your credit card,” says Bera.

If: You’re thinking about investing
Do this:
Study your timeline

If you’ve built up enough savings that you’re starting to wonder how to start investing, well, first give yourself a giant high five because you’re well ahead of your peers. Then, “understand your time horizon,” says Nielsen. “You always want to keep your money in FDIC-insured accounts if you have a time horizon of less than three years,” he says. That’s because with short-term goals, you can’t risk losing your savings to a temporary dip in the market. Once you’ve socked away enough to cover six months of living expenses, look at what your next goal is and when you think you’re going to need that money. “If you have a short two- to three-year time horizon for a major purchase, short-term CDs [certificate of deposit accounts] are a good option to explore,” he says.