Anatomically modern humans are thought to have arrived on the Indian subcontinent between 73,000 and 55,000 years ago. Settled life, which involves the transition from foraging to farming and pastoralism, began in South Asia around 7,000 BCE. The domestication of wheat and barley, rapidly followed by that of goats, sheep, and cattle, has been documented at Mehrgarh, Balochistan. By 4,500 BCE, settled life had become more widely prevalent, and eventually evolved into the Indus Valley Civilization, an early civilization of the Old world, contemporaneous with Ancient Egypt and Mesopotamia. It flourished between 2,500 BCE and 1900 BCE in what today is Pakistan and north-western India, and was noted for its urban planning, baked brick houses, elaborate drainage, and water supply.
In the beginning of the second millennium BCE climate change, with persistent drought, led to the abandonment of the urban centers of the Indus Valley Civilisation. Its population resettled in smaller villages, and, in the north-west, mixed with Indo-Aryan tribes, who moved into the area in several waves of migration, also driven by the effects of this climate change. The Vedic period was marked by the composition of the Vedas, large collections of hymns of some of the Aryan tribes, whose postulated religious culture, through synthesis with the preexisting religious cultures of the subcontinent, gave rise to Hinduism. The caste system, which created a hierarchy of priests, warriors, and free peasants, but which excluded indigenous peoples by labeling their occupations impure, arose later during this period. Towards the end of the period, around the sixth century BCE, a second urbanisation took place with the consolidation of small kingdoms (janapadas) into larger states called mahajanapadas. This renewed urbanisation led to the rise of new ascetic or Śramaṇa movements, including Jainism and Buddhism, which challenged the orthodoxy of rituals, and gave rise to new religious concepts.
Most of the Indian subcontinent was conquered by the Maurya Empire during the 4th and 3rd centuries BCE. From the 3rd century BCE onwards Prakrit and Pali literature in the north and the Tamil Sangam literature in southern India started to flourish. Wootz steel originated in south India in the 3rd century BCE and was exported to foreign countries. During the Classical period, various parts of India were ruled by numerous dynasties for the next 1,500 years, among which the Gupta Empire stands out. This period, witnessing a Hindu religious and intellectual resurgence, is known as the classical or "Golden Age of India". During this period, aspects of Indian civilisation, administration, culture, and religion spread to much of Asia, while kingdoms in southern India had maritime trade with the Middle East and the Mediterranean. In many parts of Southeast Asia, Indian cultural influence led to the establishment of Indianised kingdoms (Greater India).
The most significant event between the 7th and 11th century was the Tripartite struggle centred on Kannauj that lasted for more than two centuries between the Pala Empire, Rashtrakuta Empire, and Gurjara-Pratihara Empire. Southern India saw the rise of multiple imperial powers from the middle of the fifth century, most notably the Chalukya, Chola, Pallava, Chera, Pandyan, and Western Chalukya Empires. The Chola dynasty conquered southern India and successfully invaded parts of Southeast Asia, Sri Lanka, the Maldives, and Bengal in the 11th century. In the early medieval period Indian mathematics, including Hindu numerals, influenced the development of mathematics and astronomy in the Arab world.
Islamic conquests made limited inroads into modern Afghanistan and Sindh as early as the 8th century, and the Delhi Sultanate was founded in 1206 CE by Central Asian Turks who ruled the major portions of the Indian subcontinent in the early 14th century, but declined in the late 14th century. This period saw the emergence of several Muslim Sultanates such as Bengal Sultanate, Jaunpur Sultanate, Bahamani Sultanate, Gujarat Sultanate and Malwa Sultanate and also some Hindu states, notably Vijayanagara, Gajapati, and Ahom, as well as Rajput states, such as Mewar. The 15th century saw the advent of Sikhism. The early modern period began in the 16th century, when the Mughal Empire conquered most of the Indian subcontinent. The Mughals suffered a gradual decline in the early 18th century, which provided opportunities for the Marathas, Sikhs and Mysoreans to exercise control over large regions of the subcontinent.
From the late 18th century to the mid-19th century, large areas of India were annexed by the British East India Company of the British Empire. Dissatisfaction with Company rule led to the Indian Rebellion of 1857, after which the British provinces of India were directly administered by the British Crown and witnessed a period of rapid development of infrastructure, economic decline and major famines. During the first half of the 20th century, a nationwide struggle for independence was launched, led by the Indian National Congress, which was later joined by other organisations. The Indian subcontinent gained independence from the United Kingdom in 1947, after the British provinces were partitioned into the dominions of India and Pakistan and the princely states all acceded to one of the new states.