"We declare and define as saints the blessed John XXII and John Paul II," the Catholic leader said in a Latin prayer, as pilgrims and foreign dignitaries massed in St Peter's Square applauded and chanted: "Amen!"
In his homily, Francis praised them as "men of courage" who worked "in renewing and updating the Church".
"They were priests, bishops and popes of the 20th century. They lived through the tragic events of that century but they were not overwhelmed by them.
"For them, God was more powerful," he said.
Pope emeritus Benedict XVI, who last year became the first pontiff to resign since the Middle Ages, made a rare public appearance in his white papal cassock.
Francis embraced him warmly at the ceremony and co-celebrated the mass with the 87-year-old Benedict and hundreds of bishops and cardinals -- the first time that two living popes have ever said mass together.
It was also the first time that two Catholic Church leaders were being declared saints on the same day.
The Vatican said 800,000 people followed the event dubbed "four-pope day", including 500,000 in and around St Peter's Square.
Many faithful waved the red-and-white flags from John Paul II's native Poland and some wore Polish folk costumes, while one pilgrim held a banner reading: "Two pope saints in heaven, two in St Peter's Square".
"We are followers of all four popes who have all been close to the people. This is a historic day but one that you really feel inside," said Luisa Tomolo, an Italian revelling in the festive atmosphere.
Thousands watched the ceremony on giant screens set up in picturesque spots of Rome, witnessing an unprecedented event seen as a way of uniting conservative and reformist wings of Catholicism.
- 'Fighter for freedom' -
The hugely popular John Paul II was also a divisive figure who alienated many leftist Catholics during his 27-year reign, and he has been criticised for turning a blind eye to revelations of child sex crimes by priests.
The charismatic globe-trotting John Paul helped topple communism in Eastern Europe and John XXIII or "Good Pope John" is best remembered for launching a process of reform of the Catholic Church in the 1960s.
Former German chancellor Helmut Kohl paid tribute to John Paul II in an editorial for Il Messaggero in which he described him as "a fearless fighter for freedom".
The Polish pope (1978-2005), who became a media superstar, survived an assassination attempt by Turkish extremist Mehmet Ali Agca in St Peter's Square in 1981.
His sainthood was sped up and comes just nine years after his death -- the fastest canonisation since the 18th century when the current rules were adopted.
John XXIII (1958-1963) helped bring to an end official Catholic prejudice against Jews and has been credited as a peacemaker in the Cold War, including in helping to defuse tensions during the 1962 Cuban Missile Crisis.
- Record canonisation -
By sainting them together, Francis was appealing to "rival camps within the Catholic fold who see John XXIII and John Paul II as their heroes", said US-based Vatican expert John Allen from the Boston Globe.
Experts also noted that the move gives Francis a stronger unifying role and say it was a bold step towards stamping his authority over the Vatican.
The Vatican said 98 foreign delegations were present including former Polish president and Solidarity leader Lech Walesa -- a longtime ally of John Paul II.
The kings of Belgium and Spain also attended, with Queen Sofia of Spain wearing a white dress -- a traditional privilege of the queens of mainly Catholic countries in the presence of popes.
Zimbabwean President Robert Mugabe was also in attendance, despite a ban from entering the European Union. The interdiction does not apply in Vatican City, the smallest sovereign state in the world.
Two foreign dignitaries even took "selfie" pictures with the pope when they shook hands after the ceremony and Polish President Bronislaw Komorowski got his wife to take a picture of him with the Argentine pontiff.
French Prime Minister Manuel Valls brushed off criticism that his trip -- his first abroad -- might contradict France's secularism but signalled that he wanted to improve ties with the Catholic Church.
After the ceremony, Francis also boarded his "popemobile" for a long tour around the crowd, with some pilgrims climbing onto friends' shoulders to get a look and others throwing T-shirts and flags at the pope.