Railroad stocks have been chugging along at full speed this year, making the most of strong freight fundamentals, robust manufacturing activity, and a reviving coal market. Railroads' importance to the economy can't be understated: They haul nearly one-third of all exports, supporting economic activity worth at least $250 billion each year by moving goods across the nation. The Association of American Railroads doesn't call freight rail the "engine that moves America" for nothing.

For investors, the time is ripe to invest in railroad stocks, and there are plenty of good railroad stocks to choose from. Based on revenue, seven major railroads have been classified as U.S. "Class 1." Among these, Grand Trunk Corporation and Soo Line Corporation are the U.S. subsidiaries of Canadian National Railway (CNI -0.76%) and Canadian Pacific Railway (CP -0.69%), respectively, and since both Canadian railroads by themselves are big enough to qualify as Class 1 railroads, I've listed them instead of their subsidiaries:

Railroad stock Year-to-Date Returns* FY 2016 Operating Ratio Dividend Yield*
Burlington Northern Santa Fe NA 65.5% NA
Canadian National Railway 17% 55.9% 1.6%
Union Pacific Corporation (UNP -0.74%) 7.6% 63.5% 2.2%
Canadian Pacific Railway  10.6% 58.6% 1%
CSX Corporation (CSX -0.25%) 52.8% 69.4% 1.5%
Norfolk Southern Corp. (NSC -1.60%) 15.5% 68.9% 2%
Kansas City Southern (KSU) 12.9% 64.8% 1.4%

Operating ratio data source: Companies' financials *As of June 1, 2017. 

Among these, the following are the three best railroad stocks to buy today.

Canadian National Railway: The best railroad stock to own

Canadian National stands out for several reasons. First, as the only transcontinental railroad in North America that touches three key coasts -- the Atlantic, Pacific, and Gulf of Mexico – it has the widest reach among its peers. Second, Canadian National is the most efficient railroad, with the lowest operating ratio and best-in-class margin. Operating ratio is a key measure of efficiency railroads use to calculate the percentage of operating expenses to net sales; the lower, the better.

A freight train with cars of various colors sits on a track, with a cloudy sky in the background.

Now is a great time to invest in railroad stocks. Image source: Getty Images.

Canadian National is going great guns, having recently delivered a 9% jump in car loadings, 12% growth in net income, and a 45% surge in free cash flow for its first quarter. Its cash-generating capabilities and strong financials have always been a strong point, as the railroad has rewarded shareholders with annual dividend increases every year since it started paying a dividend in 1996, even doubling its dividends since 2000. That's no easy feat for a cyclical stock, which is one of the reasons Canadian National stock belongs in Bill Gates' portfolio.

With management boosting its fiscal 2017 earnings-per-share growth guidance to a range of 8%-11% from its earlier mid-single-digit projections, investors can't go wrong making room for Canadian National in their portfolios.

CSX Corp.: The best is yet to come

It's been quite a ride for CSX so far this year, with the stock's astounding year-to-date performance coming largely on the back of a major management shake-up when Hunter Harrison abruptly stepped down as the CEO of Canadian Pacific to set his sights on CSX. As Harrison is also an activist investor, investors knew to watch his moves. He's had a knack for turning railroads around, including Canadian National and Canadian Pacific. Within a couple of months, Harrison took over as the new CEO at CSX, sending the stock soaring. 

CSX delivered strong Q1 numbers and projects a mid-60s operating ratio, with adjusted EPS growth of 25% for fiscal 2017. Both of those figures indicate substantial improvements over last year. And that's not all: CSX also increased its dividend by 11% and announced a share-repurchase program worth $1 billion in April, reaffirming its commitment to shareholders.

I see big things coming for CSX as Harrison prepares to announce a "multi-year strategy and guidance" later this year. Given Harrison's record at Canadian Pacific (more on that in a moment), CSX appears to be in strong hands now. Best of all, you're still not late to the party. Good opportunities for growth remain as the company embarks on its transformational journey.

Two railroad tracks cross at a junction.

Major railroads are on the right growth track. Image source: Getty Images.

Canadian Pacific: In top form

If you think Harrison's exit doesn't make Canadian Pacific as attractive anymore, consider that the railroad is already in top shape thanks to the transformation it underwent through Harrison's leadership.

Most other U.S.-based railroads simply aren't in the best shape. Union Pacific has its set of challenges, Kansas City Southern's exposure to Mexico is a concern in the current political environment, and Norfolk Southern still has a lot of catching up to do in terms of efficiency, with management expecting its operating ratio to improve only to below 65% by 2020. 

In contrast, Canadian Pacific laid out big goals for itself in 2012, the primary ones being to become "the best railroad in North America" over the next five years and bring down its operating ratio to the mid-60s by 2016. The company beat its own goals by hitting a record low operating ratio of 58.6% last year. That makes Canadian Pacific way more efficient than its North American rivals.

Chart showing FY 2016 operating ratio for all seven railroads.

Data source: companies' financials. Chart by author.

It will be CEO Keith Creel's job to maintain the company's operating ratio below 60% going forward. That shouldn't be difficult since key end markets such as coal and fertilizers are in recovery mode.

What's more, Canadian Pacific doubled its earnings per share between 2012 and 2016, and investors can expect higher dividends, as the company currently pays out a measly 20% of profits despite torrid growth in earnings and strong free cash flow.

In all, Canadian Pacific should keep investors happy in the long run.