A virelai is a form of medieval French verse used often in poetry and music. It is one of the three formes fixes (the others were the ballade and the rondeau) and was one of the most common verse forms set to music in Europe from the late thirteenth to the fifteenth centuries.

One of the most famous composers of virelai is Guillaume de Machaut (c. 1300–1377), who also wrote his own verse; 33 separate compositions in the form survive by him. Other composers of virelai include Jehannot de l'Escurel, one of the earliest (d. 1304), and Guillaume Dufay (c. 1400–1474), one of the latest.

By the mid-15th century, the form had become largely divorced from music, and numerous examples of this form (including the ballade and the rondeau) were written, which were either not intended to be set to music, or for which the music has not survived.

A virelai with only a single stanza is also known as a bergerette.

Musical virelai

thumb|right|Structural schema of the virelai.

The virelai as a song form of the 14th and early 15th century usually has three stanzas, and a refrain that is stated before the first stanza and again after each. Within each stanza, the structure is that of the bar form, with two sections that share the same rhymes and music (Stollen), followed by a third (Abgesang). The third section of each stanza shares its rhymes and music with the refrain. Thus, it can be schematically represented as AbbaA, where "A" represents the repeated refrain, "a" represents the verse set to the same music as the refrain, and "b" represents the remaining verses set to different music.

Within this overall structure, the number of lines and the rhyme scheme is variable. The refrain and Abgesang may be of three, four or five lines each, with rhyme schemes such as ABA, ABAB, AAAB, ABBA, or AABBA. Another form described by Père Mourgues is the virelai nouveau, which has a two-line refrain at the beginning, with each stanza ending with a repetition of either the first or the second refrain verse in alternation, and the last stanza ending in both refrain verses in reversed order. These forms have occasionally been reproduced in later English poetry, e.g. by John Payne ("Spring Sadness", a virelai ancien), and Henry Austin Dobson ("July", a virelai nouveau).