Guru Har Rai is notable for maintaining the large army of Sikh soldiers that the sixth Sikh Guru had amassed, yet avoiding military conflict. He supported the moderate Sufi influenced Dara Shikoh instead of conservative Sunni influenced Aurangzeb as the two brothers entered into a war of succession to the Mughal Empire throne.
After Aurangzeb won the succession war in 1658, he summoned Guru Har Rai in 1660 to explain his support for the executed Dara Shikoh. Guru Har Rai sent his elder son Ram Rai to represent him. Aurangzeb kept Ram Rai as hostage, questioned Ram Rai about a verse in the Adi Granth – the holy text of Sikhs at that time. Aurangzeb claimed that it disparaged the Muslims. Ram Rai changed the verse to appease Aurangzeb instead of standing by the Sikh scripture, an act for which Guru Har Rai is remembered for excommunicating his elder son, and nominating his younger son Har Krishan to succeed him. Har Krishan became the eighth Guru at age five after Guru Har Rai's death in 1661. Some Sikh literature spell his name as Hari Rai ji.
Guru Har Rai was born to Nihal Kaur and Baba Gurditta into a Sodhi household. His father died while he was 8 years old. At age 10, in 1640, Guru Har Rai was married to Mata Kishan Kaur (sometimes also referred to as Sulakhni) the daughter of Daya Ram. They had two children, Ram Rai and Har Krishan, the latter of whom became the eighth Guru.
Guru Har Rai had brothers. His elder brother Dhir Mal had gained encouragement and support from Shah Jahan, with free land grants and Mughal sponsorship. Dhir Mal attempted to form a parallel Sikh tradition and criticised his grand father and sixth Guru, Hargobind. The sixth Guru disagreed with Dhir Mal, and designated the younger Har Rai as the successor.
Authentic literature about Guru Har Rai life and times are scarce, he left no texts of his own and some Sikh texts composed later spell his name as "Hari Rai".[Some of the biographies of Guru Har Rai written in the 18th century such as by Kesar Singh Chhibber, and the 19th-century Sikh literature are highly inconsistent.