Toxic dipeptide repeat (DPR) proteins are produced from expanded G4C2 hexanucleotide repeats in the C9ORF72 gene, which cause amyotrophic lateral sclerosis (ALS) and frontotemporal dementia (FTD). Two DPR proteins, poly-PR and poly-GR, repress cellular translation but the molecular mechanism remains unknown. Here we show that poly-PR and poly-GR of ≥ 20 repeats inhibit the ribosome’s peptidyl-transferase activity at nanomolar concentrations, comparable to specific translation inhibitors. High-resolution cryo-EM structures reveal that poly-PR and poly-GR block the polypeptide tunnel of the ribosome, extending into the peptidyl-transferase center. Consistent with these findings, the macrolide erythromycin, which binds in the tunnel, competes with the DPR proteins and restores peptidyl-transferase activity. Our results demonstrate that strong and specific binding of poly-PR and poly-GR in the ribosomal tunnel blocks translation, revealing the structural basis of their toxicity in C9ORF72-ALS/FTD.