Flying with vapes is like bringing electronics, liquids, and smoking substances on a plane—because, technically, vapes are all three. So while you are allowed to fly with your vapes, cartridges, and oils, there are rules and restrictions that you have to follow.

Once you’ve ticked everything off the TSA’s checklist, you’re free to fly without having to worry about leaving your devices at the airport.

The TSA spells out how to travel with vapes very clearly:

“Battery-powered E-cigarettes, vaporizers, vape pens, atomizers, and electronic nicotine delivery systems may only be carried in the aircraft cabin (in carry-on baggage or on your person).”

That means that all vape devices (cartridges, mods, pens, batteries, chargers, etc.) should travel in your carry-on bags or your pockets—never in your checked luggage. This is because vapes are powered by lithium batteries which, under extreme heat or stress, can burst into flames. And you don’t want that to happen in a non-manned cargo hold.

The most important thing to do when packing vape cartridges is to keep them spill-proof. Cabin pressure can cause full vape tanks or cartridges to expand, crack, and then leak, possibly leaving you with a bag full of e-juice or oil. To avoid this, empty the cartridges (or at least only fill them partially, up to two-thirds of the container) before flying. For extra insurance, you can wrap them in bubble wrap or a soft piece of cloth, then keep them in a resealable plastic bag; you can also use a vape case.

If you’re going on a long trip, you’re probably bringing extra e-juice and oils with you. But be mindful to follow TSA rules about flying with liquids. If you’re keeping your e-juice in your carry-on alongside the rest of your vaping devices, make sure that it’s in a travel container that doesn’t go over 100ml (3.4 oz) and it fits in a one-quart clear, resealable plastic bag with all your other liquids, gels, creams, etc. The same rules may apply if you’re keeping the liquid in vape cartridges, tanks, or pods.

That doesn’t mean you can only bring that much e-juice on the flight though. Anything over 100ml—at no limit—can be stored in your checked luggage. Just make sure that they’re sealed properly to avoid leaking. Place them in plastic containers (not glass, since these might break), seal the tops, and place them in spill-proof bags.

Since vapes are allowed in a plane, that must mean that you can fly with cannabis vapes too, right; you just have to follow the same rules? Well, not exactly.

Although some people have traveled with their cannabis vapes and pens with no problem, flying with CBD or THC cartridges is still a big risk. In the air, you’re under federal jurisdiction. And since marijuana is still federally illegal, flying with anything related to it can end with you being fined, arrested, or jailed upon arrival at your destination.

TSA doesn’t actively search for marijuana during pre-flight checks. But if they do find anything suspicious and hand it over to local authorities, that’s a whole other story. So to be safe, it’s best to leave the cannabis at home.

Risks understood, there are ways to safely fly with CBD or THC cartridges. You can empty and thoroughly clean pens, vaporizers, and cartridges (to where there’s no cannabis residue at all), then take them as you would regular vapes.

Otherwise, you can take out the cartridge, liquid or oil included (with any labels or packaging suggesting it’s CBD or THC removed to be safe), and throw it into your checked bag rolled into a sock or placed with other liquids. Make sure that it’s only the cartridge, though, since batteries must be placed in your carry-on. This is easier done (and marginally less risky) when flying between two legal states.

Flying with vapes is okay, as long as you follow the rules set by the TSA and your airline. Flying with CBD or THC cartridges is risky and is generally discouraged—but there are ways to do it safely, too, if necessary.