Fossils and the remains of tools show that the Indonesian archipelago was inhabited by Homo erectus, known as "Java Man", between 1.5 million years ago and 35,000 years ago. Homo sapiens reached the region by around 45,000 years ago. Austronesian peoples, who form the majority of the modern population, migrated to Southeast Asia from Taiwan. They arrived in Indonesia around 2000 BCE, and as they spread through the archipelago, confined the indigenous Melanesian peoples to the far eastern regions.
Ideal agricultural conditions and the mastering of wet-field rice cultivation as early as the 8th century BCE, allowed villages, towns, and small kingdoms to flourish by the 1st century CE. Indonesia's strategic sea-lane position fostered inter-island and international trade, including links with Indian kingdoms and China, which were established several centuries BCE. Trade has since fundamentally shaped Indonesian history.
From the 7th century CE, the powerful Srivijaya naval kingdom flourished as a result of trade and the influences of Hinduism and Buddhism that were imported with it. Between the eighth and 10th centuries CE, the agricultural Buddhist Sailendra and Hindu Mataram dynasties thrived and declined in inland Java, leaving grand religious monuments such as Borobudur, Sewu and Prambanan. This period marked a renaissance of Hindu-Buddhist art in ancient Java.
Around the first quarter of the 10th century, the centre of the kingdom was shifted from Mataram area in Central Java to Brantas River valley in East Java by Mpu Sindok, who established the Isyana Dynasty. Subsequently, series of Javanese Hindu-Buddhist polities rise and fall, from Kahuripan kingdom ruled by Airlangga to Kadiri and Singhasari. In West Java, Sunda Kingdom was re-established circa 1030 according to Sanghyang Tapak inscription. In Bali, the Warmadewas established their rule on the Kingdom of Bali in the 10th century. The Hindu Majapahit kingdom was founded in eastern Java in the late 13th century, and under Gajah Mada, its influence stretched over much of Indonesia.
The earliest evidence of Islamised populations in Indonesia dates to the 13th century in northern Sumatra, although Muslim traders first traveled through Southeast Asia early in the Islamic era. Other Indonesian areas gradually adopted Islam, and it was the dominant religion in Java and Sumatra by the end of the 16th century. For the most part, Islam overlaid and mixed with existing cultural and religious influences, which shaped the predominant form of Islam in Indonesia, particularly in Java.
The first regular contact between Europeans and the peoples of Indonesia began in 1512, when Portuguese traders, led by Francisco Serrão, sought to monopolise the sources of nutmeg, cloves, and cubeb pepper in Maluku. Dutch and British traders followed. In 1602, the Dutch established the Dutch East India Company (VOC), and in following decades, the Dutch gained foothold in Batavia and Amboina. Throughout 17th and 18th centuries, the company became the dominant European power in the archipelago.
Following bankruptcy, the VOC was formally dissolved in 1800, and the government of the Netherlands established the Dutch East Indies as a nationalised colony. For most of the colonial period, Dutch control over the archipelago was tenuous outside of coastal strongholds; only in the early 20th century did Dutch dominance extend to what was to become Indonesia's current boundaries. Japanese occupation during World War II ended Dutch rule, and encouraged the previously suppressed Indonesian independence movement. Despite major internal political, social and sectarian divisions during the National Revolution, Indonesians, on the whole, found unity in their fight for independence.
A UN report stated that four million people died in Indonesia as a result of famine and forced labour during the Japanese occupation. Two days after the surrender of Japan in August 1945, Sukarno and Hatta, the influential nationalist leaders, declared Indonesian independence. After independence, Soekarno was selected as Indonesia's first president by the PPKI, accompanied with Hatta who had been elected as first vice-president. Whereas, the first parliamentary cabinet, led by Sutan Sjahrir as prime minister. The Netherlands tried to reestablish their rule, and an armed and diplomatic struggle ended in December 1949, when in the face of international pressure, the Dutch formally recognised Indonesian independence (with the exception of the Dutch territory of West New Guinea, which was incorporated into Indonesia following the 1962 New York Agreement, and the UN-mandated Act of Free Choice of 1969).
Sukarno moved Indonesia from democracy towards authoritarianism, and maintained his power base by balancing the opposing forces of the military and the Communist Party of Indonesia (Partai Komunis Indonesia, PKI). An attempted coup on 30 September 1965 was countered by the army, which led a violent anti-communist purge, during which the PKI was blamed for the coup and effectively destroyed. Large-scale killings took place which targeted communists, ethnic Chinese and alleged leftists. The most widely accepted estimates are that between 500,000 and one million people were killed, with some estimates as high as two to three million.
The head of the military, General Suharto, outmaneuvered the politically weakened Sukarno and was formally appointed president in March 1968. His New Order administration was supported by the US government, and encouraged foreign direct investment in Indonesia, which was a major factor in the subsequent three decades of substantial economic growth. However, the authoritarian "New Order" was widely accused of corruption and suppression of political opposition.
Indonesia was the country hardest hit by the 1997 Asian financial crisis. This increased popular discontent with the New Order and led to popular protest across the country. Suharto resigned on 21 May 1998. In 1999, East Timor voted to secede from Indonesia, after a twenty-five-year military occupation that was marked by international condemnation of repression of the East Timorese.
Since Suharto's resignation, a strengthening of democratic processes has included a regional autonomy program, and the first direct presidential election in 2004. Political and economic instability, social unrest, corruption, and terrorism slowed progress; however, in the last five years the economy has performed strongly. Although relations among different religious and ethnic groups are largely harmonious, sectarian discontent and violence have persisted. A political settlement to an armed separatist conflict in Aceh was achieved in 2005.