Ashtavakra (Sanskrit: अष्टावक्रः, IAST Aṣṭāvakra) is a sage mentioned in Hindu scriptures. He is described as one born with deformities in eight limbs of the body (two feet, two knees, two hands, the chest and the head). In Sanskrit, Ashtavakra means "one having eight bends". Ashta (IAST Aṣṭa) means eight, while Vakra means bend or deformity. Ashtavakra is the author of the work Ashtavakra Gita, also known as Ashtavakra Samhita, a treatise on the instruction by Ashtavakra to Janaka about the Self. Ashtavakra is the Guru of the king Janaka and the sage Yajnavalkya.
Ashtavakra is first referenced in a single verse (6.119.17) of Yuddha Kanda in Valmiki's Ramayana. When Dasaratha comes to see Rama from heaven after the war of the Ramayana, he tells Rama -
In the Vana Parva of the Mahabharata, the legend of Ashtavakra is described in greater detail. On losing the game of dice with the Kauravas, the five Pandava princes and Draupadi are exiled for twelve years. On their pilgrimage, they meet the sage Lomasha, who shows the river Samanga to Yudhishthira. Lomasha says that this is the same river, on bathing in which the deformed Ashtavakra was cured of his eight deformities. On being asked by Yudhishthira, Lomasha narrates to the Pandava princes the legend of Ashtavakra, which forms three chapters of the Mahabharata.