The Sun and other stars are magnetic: magnetism pervades their interiors and affects their evolution in a variety of ways. In the Sun, both the fields themselves and their influence on other phenomena can be uncovered in exquisite detail, but these observations sample only a moment in a single star's life. By turning to observations of other stars, and to theory and simulation, we may infer other aspects of the magnetism-e.g., its dependence on stellar age, mass, or rotation rate-that would be invisible from close study of the Sun alone. Here, we review observations and theory of magnetism in the Sun and other stars, with a partial focus on the "Solar-stellar connection": i.e., ways in which studies of other stars have influenced our understanding of the Sun and vice versa. We briefly review techniques by which magnetic fields can be measured (or their presence otherwise inferred) in stars, and then highlight some key observational findings uncovered by such measurements, focusing (in many cases) on those that offer particularly direct constraints on theories of how the fields are built and maintained. We turn then to a discussion of how the fields arise in different objects: first, we summarize some essential elements of convection and dynamo theory, including a very brief discussion of mean-field theory and related concepts. Next we turn to simulations of convection and magnetism in stellar interiors, highlighting both some peculiarities of field generation in different types of stars and some unifying physical processes that likely influence dynamo action in general. We conclude with a brief