Vaccines aim to protect against or treat diseases through manipulation of the immune response, promoting either immunity or tolerance. In the former case, vaccines generate antibodies and T cells poised to protect against future pathogen encounter or attack diseased cells such as tumours; in the latter case, which is far less developed, vaccines block pathogenic autoreactive T cells and autoantibodies that target self tissue. Enormous challenges remain, however, as a consequence of our incomplete understanding of human immunity. A rapidly growing field of research is the design of vaccines based on synthetic materials to target organs, tissues, cells or intracellular compartments; to co-deliver immunomodulatory signals that control the quality of the immune response; or to act directly as immune regulators. There exists great potential for well-defined materials to further our understanding of immunity. Here we describe recent advances in the design of synthetic materials to direct immune responses, highlighting successes and challenges in prophylactic, therapeutic and tolerance-inducing vaccines.