The 35-year-old Swiss has a first-round bye in the Canadian hardcourt event, his first tuneup for the US Open, which begins August 28 in New York.
Federer's first foe since claiming his eighth Wimbledon crown will be the winner of a first-round match between Canadians Vasek Pospisil and Peter Polansky, according to the draw made Friday.
For the first time since 2011 in Monte Carlo, top-ranked French Open winner Rafael Nadal and second-ranked Federer, who also won this year's Australian Open, find themselves at opposite ends of a draw as top seeds.
Nadal's first match will be against either Croatian Borna Coric or a qualifier.
READ ALSO: Wawrinka skips North American tournaments due to injury