Over the half century since its discovery, the cosmic microwave background (CMB) has revolutionized our understanding of cosmology. Current experiments are carefully measuring the faint intensity and polarization anisotropies of the CMB. Improvements in these measurements could allow us to further constrain cosmological parameters, to better understand the physics of neutrinos, and to detect a possible signature of cosmic inflation. Existing detectors used to measure the CMB are already operating near the fundamental sensitivity limit set by photon noise. Thus, to increase sensitivity, upcoming experiments will require much larger detector arrays containing tens or hundreds of thousands of pixels. Microwave kinetic inductance detectors (MKIDs) are a candidate to replace current detector technologies because they may be better suited for these large arrays. I will first give an overview of cosmology with the CMB, then will introduce the physics of MKIDs and their current applications in (sub)millimeter and optical astronomy.