The son of the Czech king Wenceslaus II, Wenceslaus III (King of Hungary in 1301–1305), who was engaged to his daughter Endre III, made a claim to the throne. Later on Duke Otto Wittelsbach of Lower Bavaria (Otto, King of Hungary in 1305-1307) made a claim to the throne, as well as Karl-Robert (Karoy I), who was crowned in Esztergom in 1301, but who did not manage to seize the throne. Most of the Hungarian magnates supported the Czech claimant, however, Albrecht Habsburg, Pope Boniface VIII and the powerful Croatian tycoon Pavel Shubich spoke on Karoy’s side. In 1305, Laszlo claimed the throne in favor of Otto of Bavaria, who was crowned under the name of Bela V. Karoy successfully led military operations against him and in 1307 an influential Transylvanian voivode Laszlo Kahn captured Otto and forced him to leave the country. The 19-year-old Charles I was the only contender and in 1308 he finally became king, having founded the Anjou dynasty. However, the largest magnates – Laszlo Kahn and Matthew III Csák – did not submit to the young king; throughout Hungary, the feudal lords ruled as independent sovereigns. Charles I (1308–1342) spent many years trying to restore royal power. Finally the death of Matthew III Csák (1321) and the overthrow of Mladen Shubich (1322) allowed the king to unite Hungary; in 1323 he moved his residence from Temesvara to Visegrád.
Charles I was able to revive the economy, relying on income from gold mines, skillfully carried out financial and customs reforms. However, his foreign policy which aimed aimed primarily at the subordination of Bosnia, Serbia and Wallachia was unsuccessful: in 1330 he suffered a crushing defeat from the Wallachian ruler Basarab I, and in 1336 a defeat from the Serbian king Stefan Dusan, where as a result he lost Belgrade.
The son of Charles I and Elizabeth (daughter of the Polish king Wladyslaw Lokot and sisters of Casimir III the Great) – Lajos (Louis) I, bore the royal title in 1342-1382. His rule is traditionally considered to be the period of the maximum flourishing of the military and political might of Hungary. Under Lajos I, many states of the Balkan Peninsula recognized the Hungarian king as their overlord. In 1347, Lajos undertook a great campaign in Italy to avenge the death of his younger brother, Endre, who was killed on the orders of his wife, Giovanna I. The Hungarian army passed through Verona, Romagna, past Rome, and in February 1348 entered Naples. Layosh appointed his governors in the cities of the Neapolitan kingdom, but the plague epidemic that swept Europe at that time forced him to withdraw the army. In 1349, the Hungarians again invaded southern Italy; the kingdom was engulfed in a fierce war between supporters of Giovanna and Lajos. In 1350, Lajos himself landed in Italy and approached Naples, but the patronage of Pope Clement VI helped Giovanna to conclude a profitable negotiation, as a result of which the Hungarians were forced to leave the Neapolitan kingdom.
The plague epidemic bypassed Hungary because it still remained a relatively rare country: as a result, Western Europe experienced decline in the 2nd half of the 14th century, while the Kingdoms of Czech, Hungary, Poland, and Lithuania — rose. Hiking to Italy contributed to the development of culture among the Hungarians; Lajos encouraged education, opened schools, and in 1367 – the academy. He also undertook campaigns in Galitsky Rus, but in the end he conceded Hungary to his maternal uncle, the Polish king Casimir III the Great. In 1353, he repelled the invasion of the Horde Tatars, and drove them out of Moldova. In the Balkans, Lajos undertook more than a dozen campaigns, mainly under the slogan of eradicating the Bohemian heresy. Against Venice, he made an alliance with Genoa, started a war for Dalmatian cities, acting not only in Dalmatia, but also in Northern Italy. By the beginning of 1358 almost all the Dalmatian town recognized the authority of Hungary, in the same year, he voluntarily submitted to the ban of Bosnia, Tvrtko I. Dubrovnik came under the protectorate of Hungary, from which time the city began to flourish, which lasted until 1526.
As the son of Elizabeth, the sister of the Polish king Casimir III, who had no legal heir, Lajos in 1370 received the Polish crown.
Louis also had no sons, so he left Hungary and Poland to his daughters, Maria and Yadviga. Under Maria (1382–1387), her mother Elizabeth, daughter of Bosnian ban Stephen II Kotromanić, ruled. Maria was engaged to the son of the German Emperor Charles IV of Luxembourg – Sigismund. However, in 1385, a hostile party managed to put the Neapolitan King Charles III on the Hungarian throne, under the name of Charles II (1385–1386). Charles II united the two kingdoms for a short time, but in February 1386, he was killed as a result of a conspiracy organized by Elizabeth. In turn, the Croats, who supported the claims to the Hungarian throne of the son of Karoy II – Vladislav, who became king of Naples, came out against the widowed queen. In 1387, the Croats captured Elizabeth and Maria. While Elizabeth was killed, Sigismund of Luxemburg was able to rescue Maria, later on he led his troops to Hungary and became king.