Exhibit 5.1
The Board of Directors
Canadian National Railway Company:
We consent to the use of our report dated January 31, 2024, on the consolidated balance sheets of Canadian National Railway Company as at December 31, 2023 and 2022, the related consolidated statements of income, comprehensive income, changes in shareholders’ equity and cash flows for each of the years in the two-year period ended December 31, 2023, and the related notes, and our report dated January 31, 2024 on the effectiveness of internal control over financial reporting as of December 31, 2023, which are incorporated herein by reference.
/s/ KPMG LLP
April 2, 2024
Montréal, Canada