Expansions of short nucleotide repeats produce several neurological and neuromuscular disorders including Huntington’s disease, muscular dystrophy and amyotrophic lateral sclerosis. A common pathological feature of these diseases is the accumulation of the repeat containing transcripts into aberrant foci in the nucleus. RNA foci, as well as the disease symptoms, only manifest above a critical number of nucleotide repeats, but the molecular mechanism governing foci formation above this characteristic threshold remains unresolved. Here, we show that repeat expansions create templates for multivalent base-pairing, which causes purified RNA to undergo a sol-gel transition at a similar critical repeat number as observed in the diseases. In cells, RNA foci form by phase separation of the repeat-containing RNA and can be dissolved by agents that disrupt RNA gelation in vitro. Analogous to protein aggregation disorders, our results suggest that the sequence-specific gelation of RNAs could be a contributing factor to neurological disease.