Undergraduates with sexual and/or gender minority (SGM) identities, including lesbian, gay, bisexual, transgender, queer/questioning, pansexual, intersexual, asexual, or additional positionalities, often face an unwelcoming STEM microclimate. The STEM microclimate includes the places students experience, such as classrooms or labs, and the people, such as peers or professors, with whom they discuss their STEM program. While previous work offers a framework of microaggressions faced by SGM people, and the behavioral, cognitive, and emotional strategies they use to react to them, little is known about the strategies SGM students use to persist in the STEM microclimate. We analyze interviews with 29 SGM STEM undergraduates to uncover how they fit in STEM, their experiences that affect fit, how social capital in the form of influential others affects fit, and the strategies used to deal with microaggressions and cultivate a supportive network. Using thematic analysis, we find that students vary in their feelings of fit, with students with gender minority identities experiencing more frequent and more severe microaggressions than students with sexual minority identities (which are often less visible). We likewise find that students with racial minority identities report compounding issues related to identity. SGM students with social capital, or a network of people to whom they can turn in order to access advice and resources, believe they fit in better than those without such capital. To support their feelings of fit, students use defenses against discrimination, including micro-defenses, wherein they change how they present their self to avoid microaggressions and/or surround themselves with accepting people. This research highlights the role of microaggressions and social capital in affecting fit as well as the micro-defenses students use to defend against discrimination. Our introduction of the concept of micro-defenses provides a way to theorize about micro-interactional dynamics and the site at which students defend against microaggressions so they feel more welcome in STEM. Implications provide insight into how SGM students can be supported in STEM as well as the institutional changes STEM departments and campuses can make in order to better support and include SGM students.