Calcutta was the capital of the whole subcontinent of India for more than half a century (1849-1912) after the completion of the political unification of the subcontinent under British rule.
1849 saw the annexation of the Punjab in the Second Anglo-Sikh War.
Calcutta inherited this privilege from her previous role of having served, for nearly a century before that, as the capital of the British Raj’s principal nucleus and growing-point, which had been Bengal. [Trade in rice, muslin, jute.] Calcutta was an unsuitable capital for all India. Bengal lies in a corner of the subcontinent, and it is isolated by a barrier of hills from the great plain of Hindustan, which contains a number of eligible sites for capitals – for instance Patna, Allahabad, Agra, Delhi, and Lahore. Calcutta was not even well-placed for serving as the principal Indian terminus of the maritime line of communications that linked the British Government of India with Britain, the country which was the ultimate base and source of the British Raj’s power. Calcutta is on the far side of India from Britain. The island of Bombay, off-shore from the west coast of India, is considerably nearer to Britain via both the Cape of Good Hope and the Suez Canal, and Bombay is also easily accessible from the sea, whereas sea-going ships have to be piloted to Calcutta up the Hoogly branch of the Ganges-Brahmaputra delta. Calcutta’s feat of holding its position in these adverse circumstances is remarkable.
Bengal Presidency (Wikipedia).
Cities on the Move, OUP, 1970