The Story
Krishna's birth is told in the Harivamsa, in the Vishnu Purana (book 5, chapter 3) and most fully in the Bhagavata Purana (book 10, chapters 1 to 5). They say Vishnu was born as the eighth son of Devaki and Vasudeva at midnight, in the prison where Devaki's brother Kamsa had locked them, and that Vasudeva carried the baby across the Yamuna that same night to be raised in Gokul. Janmashtami keeps that night: people stay awake until the hour of his birth and welcome him as a newborn. The story below follows the Bhagavata.
A Voice at Devaki's Wedding
Kamsa ruled Mathura after putting his own father, King Ugrasena, in prison. He loved his cousin Devaki, and on her wedding day to Vasudeva he drove their chariot himself. On the way a voice from the sky said: 'Fool, the eighth child of the woman you are driving will kill you' (Bhagavata 10.1).
Kamsa drew his sword to kill Devaki on the spot. Vasudeva calmed him with a promise: he would hand over every child born to them. Kamsa spared her but later threw both of them into prison. One after another he killed their first six sons.
The seventh child was saved in secret. Vishnu sent his power Yogamaya to move the unborn baby from Devaki's womb to Rohini, Vasudeva's other wife, who lived safely in Gokul. That child was Balarama. Then Vishnu himself entered Devaki's womb as the eighth.
Midnight in the Prison
The Bhagavata (10.3) says the night of the birth was calm and bright. The Rohini star was rising, rivers ran clear and the sages and gods rained down flowers. At midnight, in deep darkness, Krishna was born, and the text compares him to the full moon rising in the east. This is the verse quoted at the top of this page.
Vasudeva saw a child with four arms holding a conch, a discus, a mace and a lotus, wearing a yellow cloth and a jewel on his chest. He and Devaki folded their hands and praised him. Devaki, afraid of Kamsa, asked him to hide this form. Krishna reminded them that in earlier lives they had prayed for a son like him, and then he became an ordinary newborn baby.
This is why the midnight hour matters so much to the festival. People keep the fast and the singing going until midnight, and when the hour comes they blow conches, ring bells and greet him as if he had just been born in their own home.
Across the Yamuna to Gokul
Krishna told Vasudeva to take him to Gokul. As Vasudeva picked up the baby, the guards fell asleep, his chains fell away and the heavy prison doors opened by themselves. Outside it was pouring with rain, and the great serpent Shesha followed behind, spreading his hoods over the child to keep the rain off.
The Yamuna was in flood, deep and fast, with foaming waves. The Bhagavata says she made way for Vasudeva, the way the ocean once made way for Rama. Vasudeva crossed, reached Nanda's house in Gokul, and found everyone asleep. He laid his son beside Yashoda, picked up the baby girl she had just given birth to, and walked back to the prison. The doors closed behind him and the chains were back on.
In homes across north India this crossing is the most loved part of the story. Many temples and homes build a little river scene for Janmashtami, with Vasudeva, the basket and the serpent, and children are told the story while the adults wait for midnight.
Yogamaya and the Morning in Gokul
When the guards heard a baby cry, they ran to Kamsa. He rushed in, grabbed the girl from Devaki's arms and tried to dash her against a stone. She slipped from his hands and rose into the sky as an eight-armed goddess. She was Yogamaya. 'Your killer has already been born somewhere else,' she told him, and vanished (Bhagavata 10.4). Shaken, Kamsa even asked Devaki and Vasudeva to forgive him and set them free for a while.
In Gokul, the morning was all joy. Nanda celebrated his son's birth with a great feast and gave away cows and gifts. The Bhagavata (10.5) describes the cowherds sprinkling one another with curd, milk, ghee and water and smearing each other with butter. This day after the birth is kept as Nandotsav, and the fun with curd and butter lives on in Gokul, in Vrindavan and in Maharashtra's Dahi Handi.
So the festival has two moods. The first is the hushed midnight of the birth, with fasting and prayer. The second is the noisy morning after, with sweets, curd, music and the feeling that a child has come home.
One Midnight, Kept Many Ways
In Mathura, where Krishna was born, and in Vrindavan, where he grew up, temples are packed all night. At the Banke Bihari temple in Vrindavan the mangala aarti, the pre-dawn aarti, is performed only once a year, on Janmashtami night. In Gokul the next day is Nandotsav, with curd and turmeric thrown in the lanes.
In Bihar the day is kept as Krishna Janmotsav. Many people fast without grain all day. Towns like Patna, Gaya and Muzaffarpur set up jhankis, decorated tableaux of the prison, the crossing and the cradle, and families go around at night to see them. Temples, and in many towns even police lines and jails, hold midnight celebrations, a nod to Krishna's birth in a prison. Women sing sohar, the old birth songs of Bhojpuri and Maithili homes. At midnight the image is bathed in panchamrit (milk, curd, ghee, honey and sugar), and the fast is broken with panchamrit and dhaniya panjiri, roasted coriander powder with sugar, ghee and dry fruit.
In Maharashtra the day after is Gopalkala, when teams of young men called govindas build human pyramids to break a high-hung pot of curd, the Dahi Handi. Gujarat celebrates at Dwarka and Dakor. Odisha keeps the night with fasting and the next day as Nandotsav. In Manipur, Krishna Janma is kept at the Shri Govindajee temple in Imphal. In Tamil Nadu, small footprints of baby Krishna, drawn in rice flour, lead from the door to the shrine. In Kerala it is Ashtami Rohini, with processions of children dressed as Krishna. ISKCON temples worldwide fast until midnight, sing kirtan, read the Bhagavata and bathe the deities, and keep the next day as the birthday of their founder, A. C. Bhaktivedanta Swami Prabhupada.
In the Gita (4.7-8) Krishna says that whenever goodness declines, he takes birth again, to protect the good and set dharma right. Janmashtami tells how that happened once: not in a palace, but in a locked prison at midnight, to parents who had lost six children. Keeping awake for him is a way of saying that no night is too dark for him to come.