Whenever your feet get sweaty, it sets in motion a domino effect that could ultimately lead to eccrine bromhidrosis—the medical term for stinky feet.

And more often than not, stinky feet is a totally preventable problem—and one that’s simple to cure. Since you’ve probably dealt with smelly feet at some point (or know someone you’ll passively forward this to), here are the most important things you should know about stinky feet and how to remedy them, courtesy of dermatologist Jane F. Kardashian, M.D., in Fresno, CA. She’s a fellow of the American Academy of Dermatology, and has never encountered a smelly sole she couldn’t cure.

What causes stinky feet?

It all starts with sweat. Kardashian notes that the soles of the feet (as well as the palms of the hands) harbor the highest concentration of eccrine sweat glands on the body—as many as 250,000 on each foot, in fact.

But what causes the excess sweating? Mental stimuli, for one (like if you’re stressed or anxious). But a rise in core body temperature will do the same. If you sweat excessively, you might have a condition called hyperhidrosis, but that’s rarely the case for anyone who naturally gets anxious or who routinely exercises (and thus gets sweaty feet by extension of the increased heart rate and body temperature).

“Hyperhidrosis may be due to a variety of underlying disorders,” says Kardashian. “This includes neurologic and infectious disorders, cancers like lymphomas, and endocrine diseases such as diabetes."

The sweat, then, is the culprit behind the stench. “Eccrine sweat is odorless when secreted,” says Kardashian. “But it creates an environment for certain bacteria to grow and produce bad-smelling substances.” These bacteria have villain-like names: Brevibacteria, which eat dead skin on the feet, in turn producing a sulfuric stench; propionibacteria, which produce the vinegar-smelling propionic acid; and staphylococcus epidermidis, responsible for anything cheese-like or musty.

Kardashian also cites certain foods and drugs as culprits for stinky feet: Garlic, cumin, and asparagus cause eccrine bromhidrosis, as does penicillin.

How can you prevent stinky feet?

Here are Kardashian’s suggestions for preventing stinky feet in the first place:

  1. Wash your feet daily with soap and water.
  2. Keep your toenails trimmed.
  3. Keep your feet as dry as possible.
  4. Always wear fresh, cotton synthetic blend socks that are breathable and wick away moisture.
  5. Change your footwear to ensure the material allows your feet to breathe. Try not to wear the same pair of shoes every day.
  6. Sprinkle baking soda in your shoes to kill bacteria.
  7. Use odor-eaters and absorbent powders for your feet.
  8. Before washing your socks, turn them inside out to allow the dead skin to wash away more easily.

How do you cure stinky feet?

To remedy an existing bout of foot odor, Kardashian recommends a homemade foot soak, with a high concentration of tea (yes, really) or baking soda to kill the bacteria.

If you have a serious case of hyperhidrosis, she might prescribe a topical aluminum chloride hexahydrate, which requires an electric device to send a mild electrical current into the skin, which in turn eliminates perspiration—though sometimes a simple antibiotic will do the trick, too.