Shloka (meaning "song", from the root śru, "hear") is a category of verse line developed from the Vedic Anustubh poetic meter. It is the basis for Indian epic verse, and may be considered the Indian verse form par excellence, occurring, as it does, far more frequently than any other meter in classical Sanskrit poetry. The Mahabharata and Ramayana, for example, are written almost exclusively in shlokas. The traditional view is that this form of verse was involuntarily composed by Valmiki in grief, the author of the Ramayana, on seeing a hunter shoot down one of two birds in love.
The shloka is treated as a couplet. Each hemistich (half-verse) of 16 syllables, composed of two Pādas of eight syllables, can take either a pathyā ("normal") form or one of several vipulā ("extended") forms. The form of the second foot of the first Pāda (II) limits the possible patterns the first foot (I) may assume, as in the scheme below. Alternatively, a shloka is four quarter-verses, each with eight syllables.
The Pathyā and Vipulā half-verses are arranged in the table above in order of frequency of occurrence. Out of 2579 half-verses taken from Kalidasa, Magha, Bharavi, and Bilhana, each of the four admissible forms of shloka in the above order claims the following share: 2289, 116, 89, 85.
The metrical constraints on a hemistich in terms of its two constituent padas are as follows:
Noteworthy is the avoidance of an iambic cadence in the first pāda. By comparison, Syllables 5-7 of any pāda in the old Vedic anuṣṭubh is typically a ja-gaṇa ("⏑ – ⏑"), or a dijambus.