The history of India begins with evidence of human activity of Homo sapiens as long as 75,000 years ago, or with earlier hominids including Homo erectus from about 500,000 years ago. The Indus Valley Civilization, which spread and flourished in the northwestern part of the Indian subcontinent from c. 3300 to 1300 BCE, was the first major civilization in India. A sophisticated and technologically advanced urban culture developed in the Mature Harappan period, from 2600 to 1900 BCE. This Bronze Age civilization collapsed before the end of the second millennium BCE and was followed by the Iron Age Vedic Civilization, which extended over much of the Indo-Gangetic plain and which witnessed the rise of major polities known as the Mahajanapadas. In one of these kingdoms, Magadha, Mahavira and Gautama Buddha were born in the 6th or 5th century BCE and propagated their śramanic philosophies.
Almost all of the subcontinent was conquered by the Maurya Empire during the 4th and 3rd centuries BCE. It subsequently became fragmented, with various parts ruled by numerous Middle kingdoms for the next 1,500 years. This is known as the classical period of Indian history, during which India has sometimes been estimated to have had the largest economy of the ancient and medieval world, controlling between one fourth and one third of the world's wealth up to the 18th century.
Much of northern and central India was once again united in the 4th century CE, and remained so for two centuries thereafter, under the Gupta Empire. This period, witnessing a Hindu religious and intellectual resurgence, is known among its admirers as the "Golden Age of India". During the same time, and for several centuries afterwards, southern India, under the rule of the Chalukyas, Cholas, Pallavas, and Pandyas, experienced its own golden age. During this period, aspects of Indian civilization, administration, culture, and religion (Hinduism and Buddhism) spread to much of Asia.
The southern state of Kerala had maritime business links with the Roman Empire from around 77 CE. Islam was introduced in Kerala through this route by Muslim traders. Muslim rule in the subcontinent began in 712 CE when the Arab general Muhammad bin Qasim conquered Sindh and Multan in southern Punjab in modern day Pakistan, setting the stage for several successive invasions from Central Asia between the 10th and 15th centuries CE, leading to the formation of Muslim empires in the Indian subcontinent such as the Delhi Sultanate and the Mughal Empire.
Mughal rule came from Central Asia to cover most of the northern parts of the subcontinent. Mughal rulers introduced Central Asian art and architecture to India. In addition to the Mughals and various Rajput kingdoms, several independent Hindu states, such as the Vijayanagara Empire, the Maratha Empire, Eastern Ganga Empire and the Ahom Kingdom, flourished contemporaneously in southern, western,eastern and northeastern India respectively. The Mughal Empire suffered a gradual decline in the early 18th century, which provided opportunities for the Afghans, Balochis, Sikhs, and Marathas to exercise control over large areas in the northwest of the subcontinent until the British East India Company gained ascendancy over South Asia.
Beginning in the mid-18th century and over the next century, large areas of India were gradually annexed by the British East India Company. 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 both rapid development of infrastructure and economic decline. During the first half of the 20th century, a nationwide struggle for independence was launched by the Indian National Congress and later joined by the Muslim League. The 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.