The median amount Americans hold in a savings account is about $5000, 57% of Americans could not afford a $500 surprise expense, and only 39% of Americans could pay for a $1000 surprise expense. Most folks know that having savings is a good thing and have been instructed time and time again that an emergency fund is an important financial asset to build up as you enter the workforce in your 20s, but what does this really entail, and what is it for?

The baseline rule, which you may have already heard, is that you should have three to six months of your expenses saved in an emergency fund. The savings themselves are for unforeseen events that would otherwise ruin your young professional life: your car breaks down, you have significant medical expenses, or — perhaps the most devastating and expensive of all — a major career change resulting in a move or loss of salary.

Young professionals are often faced with a series of three compounding factors: low income (you’re new in your career, it’s okay), student debt, and high cost-of-living relative to income (because you live in an expensive urban area, or you live in a rural area and thus require a car, etc.). At first, these expenses may deter you from building an emergency fund so you can keep more cash in your pockets, but an emergency fund is still important and I’d like to run through how you can build one productively.

My steadfast belief (despite conflicting thoughts) is that paying off student loans should be prioritized over immediate savings (even a solid emergency fund).I am only referring to student debt here as a big exception because it dogs many folks at the beginning of their career. If you have other debts (credit card, loans, automobile, etc.), you should probably prioritize by what has the highest interest rate (likely credit card debt). Different types of debt versus savings considerations can be made here. Generally speaking, pay off credit cards before upping your savings (because the interest rate is quite high on credit cards), but an auto loan is generally low-rate and stable enough that you can add to your savings without aggressively paying off that loan (and you’ve ideally factored it into your living expenses already as a cost of transportation). Why? Because student loans are generally at a higher interest rate than any kind of savings account you will ever find. Speaking from my own experience, I also find it eases the mind to have less debt and, as interest on student loans builds rapidly, you’ll save more money in the long-run by paying them off now. An emergency fund provides the peace of mind that, generally speaking, you will be able to handle any financial situation that may arise. If reducing debt helps reduce mental stress as well, it’s a worthy use of your cash flow (especially early on in your career, when paying off debt can have the largest impact).

Once you feel like you’re in a comfortable place with student loans (or in which you’ve set up a practical monthly payment plan for them), it’s time to prioritize an emergency fund. For most folks in the early 20s, having three months expenses is a good start: that includes rent, transportation, groceries, expenses for dependents or pets, debt (student debt included), and utilities. An easy way to think about it is to have about one-fourth to one-third of your post-tax income saved, or about six times your monthly rent. Of course, this may not necessarily be in line with your budget, as you might be spending more than you make, or vice versa, but it’s a general rule of thumb. In terms of actual dollars, you should probably save within the $6,000-$12,000 range depending on where on you live and what additional expenses you have, such as dependents and pets. When in doubt, aim to save more than you think you’ll need, as you don’t want to find yourself in a situation where you wish you’d have saved just $1000 more.

You likely won’t be able afford to put a whole third of your income away into a savings account in any given year, and that’s okay – that’s one of the reasons I’m embracing a slightly more realistic approach of aiming to save three months worth of living expenses rather than the generally-touted six months. Another argument for only saving for three months is that you can be a little more aggressive with a credit card, if necessary, to stretch your savings. Generally speaking, rent cannot be paid with a credit card, but things like groceries and gasoline can (and should!), so, even if you only build up three months living expenses in a savings account, you can run for a month or two longer by balancing purchases between your savings account and credit card.

So, what’s the best way to build your savings and where should you put them? Let’s start with the latter. You should be putting your emergency fund in a savings account with your bank or credit union to gain interest,Financial advisers used to recommend certificates of deposit as a vehicle for your emergency fund as well due to their slightly higher interest rates, but these have largely fallen out of vogue in our low-interest rate world, and are slightly more restrictive in regards to withdrawals. If you are less risk-averse, this might still be a good option for you. while your monthly expenses (rent, debit card use, credit card payments, etc.) can come out of your checking account. It’s generally recommended that you should use a checking account for your monthly expenses and put any additional income elsewhere (checking accounts return very little, if any, interest – so you may actually be losing money keeping excess amounts in there on a rolling basis).

The general strategy is to spend about 20% on savings (as noted earlier, directing some of this towards paying off student debt is fair game), so you can prioritize an emergency fund amongst your savings. If you have other one-off shots of money coming out of school or in those first few years in the workforce (like graduation gifts, tax refunds, etc.), I would highly recommend putting that money towards an emergency fund because it’ll do some of the heavy lifting without affecting your budget. And, if you’ve been saving for a while in school, you’re already on your way. However, most folks are going to need to start putting aside about 10-20% of their income towards building up an emergency fund each month. It’s going to sting, it’s going to mean fewer meals out, and may even mean rethinking your budget as a whole – but it’s important, and it’s worth it. It may take a few years to build your fund up to a level you need, and it’s something to tend to over time as your life changes (when you take on a mortgage, have kids, adopt a pet, get a new job, or move to a new city). It also builds a good habit of putting away savings each month throughout your life, as it’s something that shouldn’t go away once you have a few thousand dollars tucked away for an emergency.

Look — I get it, there’s a lot going on, and we haven’t even talked about how you should also be contributing as much as possible to a 401(k). Plus, this is all on top of student loans, expensive rents, living on your own, your first job, and the career and life ups and downs you’ll face. An emergency fund is about making sure no one event can ruin the progress you’ve made and helps you keep going even if the going gets tough — not about holding you back. The peace of mind that you have enough saved to get you through almost any surprise is a feeling most Americans don’t have and is well worth the effort.