The Reds finished runners-up in their group behind Napoli and will host the reigning European and LaLiga champions at Anfield in February.
Real beat the Reds 1-0 in the 2022 final in Paris in May, a match marred by organisational chaos which led to the kick-off being delayed.
Premier League champions and 2021 Champions League finalists Manchester City have been drawn to face German side RB Leipzig - fourth in last season's Bundesliga - in the last 16.
Tottenham, who sealed top spot in their group with a last-gasp winner from Pierre-Emile Hojbjerg away at Marseille, have been drawn to face Italian champions AC Milan with the first leg at San Siro.
Chelsea, winners of the competition in 2012 and 2021, will be up against Bundesliga runners-up Borussia Dortmund in the round of 16.
The first leg ties will be played on February 14, 15, 21 and 22, with the second legs on March 7, 8, 14 and 15.
German champions Bayern Munich - who did not drop a point in the group phase - are up against French league champions Paris St Germain, who they beat in the 2020 final of the competition.
Inter Milan, who finished runners-up behind Bayern in Group C, face Portuguese champions Porto while Club Brugge take on Benfica.
Europa League winners Eintracht Frankfurt will go up against Napoli for a place in the quarter-finals.