A lot of thought can go into picking the perfect running shoes and high-tech workout leggings. And while that stuff can seriously motivate you and enhance your workouts, let’s not forget the age-old saying: “It’s what’s on the inside that counts.” But we’re not talking about your heart—we’re talking about your skivvies.

You may not realize it, but selecting the wrong underwear for your workout can actually have an impact on the health of your lady-parts (dudes, we’ll get to your parts later—women are just more at-risk for this kind of thing). If the heat, sweat, and friction generated during your workout gets trapped below the belt due to non-breathable or ill-fitting panties (hope you’re cool with us saying “panties”—oh, hi, we just said it again), you’re at risk for the growth of fungus that can lead to complications like yeast infections or even contracting a urinary tract infection (UTI).

“Women with pre-existing issues are particularly susceptible and should pay extra attention to their workout bottoms,” says Renee Mestad, M.D., division chief of general obstetrics and gynecology at Upstate University Hospital in Syracuse, N.Y.

“The problem with the area around the vagina is that most women don’t sit down and spread out so that the air can take water away. Areas like your chest, back, or legs are exposed to air, which helps the water (read: sweat) evaporate. It’s not as easy in-between the legs.”

That struggle is so real for us women (oh, let me count the ways), but if you’re properly equipped with the right underwear, you can help ward off unpleasantries down under.

Before we get into which drawers to wear, let’s get rule No. 1 of workouts and underwear straight:

Regardless of what you wear, the best way to prevent infection is to change out of your workout clothes and take a shower right after you exercise. Hanging out in your sweaty gear can lead to a jock itch-like condition called intertrigo that is caused by trapped moisture and friction down south—and yes it is as gross and uncomfortable as it sounds.

“If you’re running, doing hot yoga, or any other activities that result in a significant amount of sweating, it would benefit you to change out of your clothes, all the way down to the underwear and into something fresh,” Mestad says. And if you can’t jump in the shower immediately after your workout or you are exercising for extended periods of time, it’s best to find breathable undies made with performance-ready fabrics.

So what makes underwear breathable? How can a fabric be performance-ready? Glad you asked.

The most breathable fabrics to work out in are those with wicking properties, like polyester, nylon, and sports wool—these materials are engineered to move moisture away from your skin. Natural materials like cotton or bamboo are acceptable for lighter exercise, like a restorative yoga class, but keep in mind that these materials are extremely absorbent and can become heavy or irritating the more sweat that’s captured.

However, even moisture-wicking fabrics have their limits, Mestad warns. “A moisture-wicking fabric is better, but it doesn’t last forever,” Mestad says. “If women use fabric softeners in their laundry with workout gear, that messes with the wicking properties so it’s probably not doing the job it needs to do.”

Katharine O’Connell-White, M.D., OBGYN at Boston Medical Center and associate professor of obstetrics and gynecology at Boston University School of Medicine, suggests you look for at least some cotton, regardless of the primary material. “The most important thing is the actual fabric that touches the skin,” O’Connell-White says. “It almost doesn’t matter what kind of underwear you wear, so long as there is a cotton panel in the middle at the part that touches the vulva.”

So now that you have the correct fabric selected, let’s talk shape.

Classic briefs or bikini-cut underpants are best. If you’re a boy-short devotee, that’s fine. But keep in mind that the more material you have down there, the more opportunity for moisture absorption, which can lead to a not-so-comfortable soggy sag.

If you’re afraid of the dreaded VPL (visible panty line) and typically opt for thongs, beware. When you work out in thongs, they tend to slide from back to front, which can move fecal bacteria to all the wrong places and lead to infections. Yikes. If you absolutely must wear a thong, be extra thoughtful about the fit. It should feel secure without leaving indentations or the feeling of being squeezed.

Mestad warns that improperly fitting t-strings may lead to worse issues than your VPL. “As the area gets damp, you’re going to experience a lot more friction,” Mestad says. “You might find yourself with small abrasions or other irritations that can then cause issues, which makes it easier for skin bacteria to penetrate the area.”

If you’re looking suspiciously at your underwear drawer right now, you may be thinking that the most breathable, non-infection-prone undies to wear are none at all, right? Maybe. But before you go commando, double-check the fabric in the crotch of your leggings or shorts—if that material isn’t moisture-wicking, you’re facing the same issues as before.

When selecting a pair of bottoms with built-in underwear, also known as a “gusseted crotch” (a super-weird term, we know), inspect the area thoroughly to be sure the surface area is smooth. Any seam or misplaced panel could cause additional irritation—and that’s the last thing you want to be worried about in that final sprint of your favorite cycling class.

And gents, the rules are pretty similar for you.

Look for a pair that provides optimal support without any squeeze. Fabrics should be sweat-wicking and breathable. Look for words like antimicrobial and synthetic materials.

As a general rule, if your underwear is designed to be seen by a special someone (think: silk, lace, intricate designs), then it most likely isn’t meant for working out in—even if you have a crush on your kickboxing instructor, sorry.

We understand that your workout bottom selections won’t always be perfect, and it’s certainly healthier to work out a few times in poor underwear than to skip the workout altogether. O’Connell-White suggests sleeping commando to counteract the damage.

“If you’ve spent a lot of time in restricting clothes—bike shorts, yoga pants, even bathing suits—you can balance it out by going to bed without underwear under your nightgown or boxers,” O’Connell-White says. “Skipping the underwear gives you (hopefully) seven to eight hours of no constriction that might make up for that intense workout earlier in the day.”

With the rise of technical fabrics in the activewear world, it shouldn’t be hard to select a solid pair of underwear to workout in. Sweaty Betty, Lululemon, and Under Armour all make great pairs. Just take an extra second to think about the material and shape before diving into another one of those 5 for $45 sale bins.

Brittany Romano is a style writer, podcast producer, and golf lover, living in NYC.