Cooking can be a lot of fun, but it can also be dangerous if you don’t know what you’re doing. And we’re not talking about accidentally burning or overcooking your food.

Oh no, the danger in the kitchen goes beyond the occasional burnt meal or two. We’re talking about a fire in the kitchen. Oh yes, it can happen, and it only takes minutes for a small fire to quickly grow into an alarming inferno.

When that happens, anyone’s first reaction is to panic. But panicking when there’s a flame threatening to grow out of control in your kitchen is only going to make matters worse. There’s a better strategy to approach this kind of situation. Take a page out of the Boy Scout’s handbook and always be prepared for kitchen fires.

Being prepared means being prepared for anything that might happen even before you step into the kitchen. Not only do you have to make sure you’ve taken all the right steps to make sure you’re as safe as possible while cooking, but you also should know what to do if you ever find yourself in such an alarming situation.

Here’s how to put out a kitchen fire quickly.

1. Make sure your smoke detectors are working.

If you want to get technical about it, smoke alarms don’t help prevent fires. But they are a preventative precaution that everyone should have installed in their home. Smoke detectors will warn you when something is amiss, an especially useful thing to have on hand if you’re away from the kitchen area for some reason at that time.

When you hear the beep of the alarm, you can quickly rush back to see what’s going on. Install them now to save your life later.

2. Wear the right kind of kitchen clothing.

Yes, wearing the right kind of clothing helps when working in the kitchen. This is part of being prepared even before starting fire safety aspects. There is a time and a place for silk robes and fluffy boas, and the kitchen is not one of those places. Loose clothing and superfluous fabric enhance the likelihood of an unintentional fire.

3. Cover the kitchen fire to cut off the oxygen supply.

If the fire happens while cooking on a stovetop, your first instinct should be to quickly grab a nearby pot or pan and cover that fire. All flames require oxygen to burn, which means that your best course of action is to shut off the oxygen supply to the pan or pot.

In case of a fire, keep a cover near the oven. If flames appear, simply cover the pan to extinguish them before they become too large. If it doesn’t work, dump baking soda (a lot of it) on the flames. This will put a stop to the flames.

If all else fails, you have two options: Use a fire extinguisher or call the fire department immediately while you still try your best to put it out.

4. Invest in a fire extinguisher.

If you don’t have one already, you should think about investing in one. You never know when it is going to come in handy. Invest in a fire extinguisher with a “UL” symbol on it. These extinguishers have symbol classifications on them.

They are classified as A (for basic “combustibles” such as wood and paper), B (for oil and gas), and C (for electrical fires). Because most kitchen fires include grease, you’ll want one that’s rated B. Smaller aerosol-style extinguishers (like hairspray cans) should be avoided since they will need you to approach the fire nearby, which is dangerous.

When using the fire extinguisher, stand eight feet away from the fire and aim above the flames to use the extinguisher. Remember that you will need to properly clean your kitchen after using an extinguisher. Use a pot cover or baking soda to put out the flames if you can.

5. Keep your microwave and oven doors closed.

If the fire happens in your microwave, immediately shut the door and keep it closed as you quickly unplug the appliance. Do not, under any circumstances, open the door to check on the flames. The idea is to cut off the oxygen supply to the fire, and the only way to do that is to keep the door shut.

The same rules apply if it is an open fire. Let the lack of oxygen do its job and cut off the fire. If the flames still keep going in your oven, then call the fire department for help.

6. Call the fire department.

If you cannot isolate the fire, or if it is starting to grow larger than a basketball, or it is spreading too quickly for you to control, call the fire department immediately.