The chapter introduces the theory of spin glasses and its applications, starting with the historical context and key concepts. Spin glasses are characterized by non-periodic freezing of magnetic moments, slow response, and linear low-temperature heat capacity, leading to the development of new analytical, experimental, and computational techniques. The essential ingredients of spin glass behavior are quenched disorder and frustration, which lead to complex cooperative behavior. The chapter discusses the thermodynamics of spin glasses, focusing on the replica theory, which is a tool for analyzing physical averages over quenched disorder. The replica-symmetric Ansatz is introduced, followed by the Parisi Ansatz, which accounts for replica symmetry breaking. The chapter also covers the Sherrington-Kirkpatrick model, which is believed to be exact for systems with infinite-ranged interactions, and discusses other infinite-ranged models. Finally, it touches on one-step replica symmetry breaking (1RSB) and its implications for conventional glasses.The chapter introduces the theory of spin glasses and its applications, starting with the historical context and key concepts. Spin glasses are characterized by non-periodic freezing of magnetic moments, slow response, and linear low-temperature heat capacity, leading to the development of new analytical, experimental, and computational techniques. The essential ingredients of spin glass behavior are quenched disorder and frustration, which lead to complex cooperative behavior. The chapter discusses the thermodynamics of spin glasses, focusing on the replica theory, which is a tool for analyzing physical averages over quenched disorder. The replica-symmetric Ansatz is introduced, followed by the Parisi Ansatz, which accounts for replica symmetry breaking. The chapter also covers the Sherrington-Kirkpatrick model, which is believed to be exact for systems with infinite-ranged interactions, and discusses other infinite-ranged models. Finally, it touches on one-step replica symmetry breaking (1RSB) and its implications for conventional glasses.