The competition’s format ensures the top six teams in La Liga last season meet the lowest ranked sides left in the last 32, the first round to involve teams from the top flight.
Formentera, the only representative from the fourth tier, will meet last season’s runners-up Sevilla.
The first legs take place between November 29 and December 1, the second from December 20-22.
Real Madrid, expelled from the competition last season for fielding a suspended player, will play their games on October 28 and November 31 due to their participation in the Club World Cup.
COPA DEL REY ROUND OF 32 DRAW
Toledo v Villarreal
Formentera v Sevilla
Cultural Leonesa v Real Madrid
Hercules v Barcelona
Guijuelo v Atletico Madrid
Racing Santander v Athletic Bilbao
UCAM Murcia v Celta Vigo
Cordoba v Malaga
Real Valladolid v Real Sociedad
Huesca v Las Palmas
Nastic v Alaves
Alcorcon v Espanyol
Sporting Gijon v Eibar
Granada v Osasuna
Leganes v Valencia
Real Betis v Deportivo La Coruna