Once there was a great king named Harishchandra who never lied and alwasy kept his promise. He was the ruler of Ayodhya. He ruled his Kingdom wisely. His subjects were happy and prosporous. He was well-known for his truthfulness. The gods decided to test him. They asked Sage Viswamitra to help them.
One day, Harishchandra went hunting in the forest. Suddenly, he heard the cries of a woman. As he went to help her, he entered the ashram of Vishwamitra. Vishwamitra was disturbed in his meditation and became angry. To cool his anger Harishchandra promised to donate his kingdom to Vishwamitra. Vishwamitra accepted his donation but also demanded dakshina (fees) to make the act of donation successful. Harishchandra, who had donated his whole kingdom, had nothing to give as dakshina. He asked Vishwamitra to wait for one month before he paid it.
A man true to his word, Harishchandra left his kingdom and went to Kashi along with his wife, Shaivya, and son, Rohitashwa. In Kashi, he could not earn anything. The period of one month was about to end. His wife requested him to sell her as a slave to get the money. Harishchandra sold Shaivya to a Brahmin. As she was about to leave with the Brahmin her son began to cry. Harishchandra requested the Brahmin to buy Rohitashwa also. The Brahmin agreed. But the money was not enough to pay the dakshina and so Harishchandra sold himself as a slave to a chandala (a person who works in a cremation ground). He paid Vishwamitra, and started working in the cremation ground.
Shaivya worked as a servant in the Brahmin's house. One day, when Rohitshwa was plucking flowers for the Brahmin, a snake bit him and he died. Shaivya took her son's body to the cremation ground. There she met Harishchandra. He was filled with grief to see his only son dead. To perform the cremation, he asked Shaivya didn't have any money. Haishchandra, who was duty bound, could not cremate the body without tax. Shaivya was a devoted wife and she did not want her husband to give up his duty. She said, "The only possession I have is this old sari that I am wearing. Please accept half of it as the tax." Harishchandra agreed to take the sari. They also decided to give up their lives on their son's cremation fire.
As Shaivya tore her sari, Vishnu himself appeared with all the other gods. The chandala, who was actually Yama, showed his real form and brought Rohitashwa back to life. Harishchandra and his family passed the test; they had demonstrated great virtue and righteousness. All the gods blessed them. Indra asked Harischandra to go to heaven with him. But he refused saying that he could not go to heaven when his subjects were suffering without him. He asked Indra to take all his subjects to heaven. Indra said that it was not possible because people go to heaven or hell depending on their deeds. Harishchandra said that he would donate all his virtues to his subjects so that they could go to heaven and he would bear the consequences of their sins. Seeing Harischandra's love for his subjects, the gods were very pleased. They took all the people of Ayodhya to heaven. Mean while, Vishwamitra brought new people to Ayodhya and made Rohitshwa the king.