Aptamers, including DNA, RNA and peptide aptamers, are a group of promising recognition units that can specifically bind to target molecules and cells. Due to their excellent specificity and high affinity to targets, aptamers have attracted great attention in various fields in which selective recognition units are required. They have been used in biosensing, drug delivery, disease diagnosis and therapy (especially for cancer treatment). In this review, we summarized recent applications of DNA and RNA aptamers in cancer theranostics. The specific binding ability of aptamers to cancer-related markers and cancer cells ensured their high performance for early diagnosis of cancer. Meanwhile, the efficient targeting ability of aptamers to cancer cells and tissues provided a promising way to deliver imaging agents and drugs for cancer imaging and therapy. Furthermore, with the development of nanoscience and nanotechnology, the conjugation of aptamers with functional nanomaterials paved an exciting way for the fabrication of theranostic agents for different types of cancers, which might be a powerful tool for cancer treatment.