What it is for
An emergency fund is not an investment. Its job is to convert a financial shock into an inconvenience, and it does that by being available immediately and being worth what it says it is worth on the day you need it.
Every other property people want from money, growth, tax efficiency, yield, is secondary here and usually in direct conflict with the two that matter.
Sizing it properly
The standard advice is three to six months of expenses. The important refinement is that it means essential expenses, not your current spending.
Add up housing, utilities, groceries, insurance, transport, and the minimum payments on any debt. Leave out restaurants, subscriptions, travel, and anything else that would stop the week you lost your income. For most households that is 60 to 70% of normal spending, so the target lands well below what a naive calculation produces.
Then adjust for how replaceable your income is. Two stable salaries in different industries need less cover than one freelance income, which is the real variable behind the three-to-six range. The emergency fund calculator works out the target and how long your current contributions take to reach it.
Where to keep it
A high-yield savings account or a money market fund. Both are liquid within a day or two, neither can fall in value, and both currently pay a meaningful rate.
Not the stock market. The correlation that matters here is the uncomfortable one: recessions cause job losses and market drawdowns at the same time, so the moment you need the money is disproportionately likely to be the moment it is worth least. That is risk in the sense that actually harms you, as distinct from ordinary volatility.
Not in a CD either, unless it is part of a ladder with a rung maturing soon. Early withdrawal penalties defeat the purpose.
Fund it or pay debt?
Purely mathematically, paying off a 24% credit card beats earning 4.5% in savings, every time. But the arithmetic ignores what happens when the car breaks down and there is no cash: the repair goes back on the card, usually along with the interest you just cleared.
The sequence most planners recommend resolves this: build a small starter fund of $1,000 to $2,000, then attack high-interest debt aggressively, then return and finish the full fund. You accept a small amount of mathematically suboptimal cash in exchange for not undoing your own progress.
Building it
Automate the transfer on payday so it happens before you can spend it, and keep the account at a different institution from your checking so it takes a deliberate act to reach.
Direct windfalls at it: tax refunds, bonuses, a month with three paychecks. Those move the number faster than any adjustment to monthly contributions, and they come from money you were not relying on anyway.
Once it is funded, stop. This money has a job and growing it further means taking capital away from goals where growth actually matters. Everything above the target belongs in long-term investments.