Here at YouBeauty we have no problem admitting that feet get gross. That includes gnarly toenails. If yours are looking roughed up, ragged, cracked or yellowed, you might think you’ve got a nail fungus—which is entirely plausible, especially after a long, sweaty summer. But if your tough-actin’ treatment isn’t cutting the mustard, it could be that the problem lies not with your feet, but with your shoes.Here are three ways your footwear might be tearing up your toenails.

Squishing your feet into undersized-by-design cycling shoes can make your toenails fall off.

1. Your workout is good for your body, but bad for your tootsies.Runners and ballet dancers have known it for years: Constantly bumping up against the front of your sneakers or slippers crunches your toes, making toenails brittle and pedicures a waste of time and money. (Don’t even get them started on the blisters and bruises.) But listen up, Revolvers, SoulCyclists and FlyWheelers. Squishing your feet into those undersized-by-design cycling shoes will do the same thing. “Feet have a tendency to swell up during prolonged periods of exercise and this can cause your shoes to be too snug, leading to blisters, or even your toenails falling off,” says Beth Bishop, partner and lead instructor of The Phoenix Effect.The fix: Bishop recommends getting your cycling shoes professionally fitted at a bike shop and investing in a good pair of socks made for cycling or distance running that won’t bunch up. During class, avoiding putting too much pressure on your toes by keeping your feet flat or heels down as you pedal.

Nearly 70 percent of people buy shoes that are too small for them.

2. Your shoes are too tight.Nearly 70 percent of people buy shoes that are too small for them. We usually think about whether our shoes are long and wide enough, but it’s also crucial to pay attention to the “toe box,” the front part of the shoe that goes up, over and around your toes. If the toe box is tight, the tops of your toes might bang up against it at every step. It’s subtle—you might not ever notice—but it adds up to thousands of microtraumas to your toenails over the course of a day. These tiny injuries accumulate and can cause onychodystrophy, the clinical term for nasty-looking nails, which can easily be confused with a fungal infection, says Dennis Shavelson, a podiatrist in New York City.The fix: When shopping, look for shoes that have a taller, wider toe box to give your piggies room to wiggle. But let’s be honest, you’re going to buy whatever shoes you want, so at the very least, switch into an opened-toed or otherwise forgiving pair every couple of days to give your nails a rest from the jackhammering. You can also get a prescription for Nuvail, a new FDA-approved polyurethane-like coating that goes on clear and protects your nails from damage (like weatherproofing a deck). It will take about six months for the nail to fully grow out.

Shoes provide an ideal environment for foot fungi: warm, dark, dank. You can cure your fungus, but if it has colonized your shoes, you’ll get it back over and over again.

3. That athlete’s foot you got at the gym is commuting with you.So despite careful flip-flop wearing in the showers at the gym, you got a fungus. It happens. But here’s the rub: When you stick fungus-laden feet into your shoes, the fungus can hang out in there long after you’ve come home and kicked them off. Shoes, Shavelson explains, provide an ideal environment for fungi: warm, dark, dank. Most antifungal creams for athlete’s foot don’t work against toenail fungus. Laser treatment or oral antifungals can knock out the organisms and clear up yellow, discolored nails, but if fungus has colonized your shoes, you’ll get it right back.The fix: Open up your shoes as wide as they’ll go—undoing buckles and pulling out insoles—and leave them out overnight to ventilate. Or sit them out all day in sunlight, which helps kill fungal spores. Spray the inside of the shoes with alcohol or a disinfectant once or twice a week, being sure to get all the way into the toe box. If you’ve had athlete’s foot before, you’re probably less resistant to it, so prevention is key. Make your shoes inhospitable to fungus by cutting down on moisture; keep your shoes dry and powder your feet daily.