Manchester City have been drawn against Borussia Dortmund, while Chelsea play Porto and defending champions Bayern Munich take on Paris St-Germain, the team they beat in last year’s final.
In the semi-finals, the winner of the Real Madrid v Liverpool tie will face Porto or Chelsea and Manchester City or Dortmund will take on Bayern or PSG.
The two-legged quarter-finals will take place on 6-7 and 13-14 April.
The first legs of the semi-final will be on 27-28 April with the return ties on 4-5 May.
Liverpool and Real Madrid met in the 2018 Champions League final with the Spanish club, who have won the competition a record 13 times, winning 3-1.
The two teams have played each other six times in Europe’s top competition, with both winning three games apiece, including Liverpool’s 1-0 victory in the 1981 final.
Their only previous meeting in a knockout tie came in the last 16 in 2009, with Liverpool winning 5-0 on aggregate.
Premier League leaders Manchester City have only met Dortmund twice. Those games came in the group stage of the Champions League in 2012, with the English side drawing 1-1 at home and losing 1-0 in Germany.
City, who are aiming to win the competition for the first time, remain on course for an unprecedented quadruple and could face England winger Jadon Sancho, who left the club in 2017 to join the German side.