Ceballos, who was named player of the tournament at the European Under-21 Championship last month as Spain finished runners-up, will then link up with his new team-mates on their pre-season tour of the United States.
The 20-year-old enjoyed an impressive season with Betis, scoring twice in 30 league appearances, and Madrid and Barca both contacted Betis for him.
Dani Cabellos has joined Real Madrid.
Despite a reputation for world-record-breaking transfers on "Galacticos", Real Madrid have changed their image in recent years - securing young, talented Spanish players. The player will be presented next Thursday July 20, at 13:00, in the VIP suite at the Santiago Bernabeu stadium.More news: USA judge exempts grandparents, other relatives from Trump's travel ban
Zinedine Zidane's side are looking to win consecutive La Liga titles for the first time since 2007/08.
Ceballos becomes Real's second signing of the summer, after Theo Hernandez joined from city rivals Atletico Madrid earlier this week for £25m.
He joins just days after James Rodriguez left for Bayern Munich.