The Core Worlds planet of Coruscant was considered the capital of the entire galaxy as it was the center of galactic culture and civilization and served as the seat of government for the Galactic Republic and the Galactic Empire. During the Clone Wars, the Outer Rim world of Raxus Secundus served as the headquarters of the Confederacy of Independent Systems and hosted the Separatist Senate.
Following the Battle of Endor, Chandrila became the capital of the New Republic, a nascent government that was created from the Rebel Alliance. To gain the support of disaffected worlds and prevent the friction that occurred under the Old Republic and the Empire, the New Republic chose not to base its government on Coruscant. Instead, member worlds would host the capital and Galactic Senate on a rotational basis through elections. About thirty years after the Battle of Endor, Hosnian Prime was the capital of the New Republic until it was destroyed by the First Order's Starkiller Base superweapon.
Several planets also had capital cities. Theed was the capital of the Mid Rim Territories world of Naboo. Mos Espa was the de-facto capital of the Outer Rim world of Tatooine. The planet Lothal also had a Capital City which contained the Imperial Complex and the Lothal City Capitol Building.