Surabaya is the capital of the Indonesian province of East Java and the country's second-largest city after Jakarta, ranking as the country's second-largest metropolis in the world. Java's capital city, Surabaya, is situated on the northeastern edge of the island, on the Madura Strait, and is one of the first port towns in Southeast Asian history. According to the National Development Planning Agency, Surabaya is one of Indonesia's four major centre cities, along with Jakarta, Medan, and Makassar, and is one of the country's most populous. Surabaya has a population of 2.87 million people inside its city boundaries and 9.5 million people in the greater Surabaya metropolitan region, which makes it the third-largest metropolitan area in Indonesia, according to the 2020 Census data.
Founded in the tenth century by the Kingdom of Janggala, one of two Javanese kingdoms that were founded in 1045 when Airlangga abdicated his throne in favour of his two sons, the city is known for its architecture and culture. Surabaya developed became a duchy, a key political and military force in eastern Java, and a major port during the late 15th and early 16th centuries, most likely under the control of the Majapahit empire. Surabaya was already a prominent commercial port at the time, due to its strategic position on the River Brantas delta and its strategic placement on the trade route connecting Malacca and the Spice Islands through the Java Sea. During the collapse of Majapahit, the ruler of Surabaya fought the advent of the Demak Sultanate, and it was only in 1530 that he finally surrendered to its authority. Surabaya established an autonomous state in 1546, after the death of Sultan Trenggana of Demak.
From the 18th century until the mid-20th century, Surabaya was the largest city in the Dutch East Indies and the centre of trading in the Indonesian archipelago, which was at the time a competitor to Shanghai and Hong Kong. Surabaya was the capital of the Dutch East Indies from the 18th century until the mid-20th century. Because of the significance of the Battle of Surabaya during the Indonesian National Revolution, the city is referred to as Kota Pahlawan (the city of heroes) among the local community. Located on the outskirts of Surabaya's northern region, the Port of Tanjung Perak is Indonesia's second-busiest seaport and is considered to be one of the most significant financial, economic, industrial, transportation, and entertainment centres of the archipelago, probably second only to Jakarta. The city is also well-known for being one of the most clean and environmentally friendly in Indonesia.