As Amazon narrows down the choices for its coveted $5 billion second headquarters, it would do well to consider Austin and Dallas — the two finalists located in Texas, CNBC's 2018 America's Top State for Business. That is according to a new CNBC analysis of the 20 finalist locations, based on our latest data. Other strong finishers include Atlanta, Boston, Denver, Miami, Nashville and Northern Virginia. The retailer has promised to name a location this year for the so-called HQ2 project, which it claims will ultimately employ 50,000 people. Amazon refuses to comment further about the timeline, but there is widespread speculation it could narrow the list of finalists as soon as this month. Amazon's initial request for proposals last year touched off a huge bidding war, with some 238 locations from Canada to Mexico submitting bids. The company listed four main criteria for the new location: Metropolitan areas with more than 1 million people.

A stable and business-friendly environment.

Urban or suburban locations with the potential to attract and retain strong technical talent.

Communities that think big and creatively when considering locations and real estate options. Each finalist passes the population test with flying colors, but their grades in the other categories vary widely. Of course, it is impossible to get into the heads of the planners at Amazon, especially Chairman and CEO Jeff Bezos. But CNBC used data from our 12th annual America's Top States for Business study to grade the locations based on the company's criteria. In the case of Washington, D.C., and Toronto — which are not included in our Top States study — we used comparable data from U.S., Canadian, District of Columbia and Ontario provincial sources. Our analysis has its limits. For example, most of the data is at the state level, so grades are identical for Austin and Dallas, as well as Philadelphia and Pittsburgh. Our report cards also assume that Amazon is giving equal weight to each of its four main criteria. But we do not know that to be the case, and the company is not saying. There is also that bit about trying to get into Jeff Bezos' head. Nonetheless, a few broad trends emerge.

ATLANTA

Overall Grade: B+

Michael Dunn | EyeEm | Getty Image

Georgia slipped to No. 7 in this year's Top States rankings. But Atlanta is still an economic powerhouse, especially considering Amazon's priorities. The city gains great stability from one of the best state economies in the nation. State finances are strong, and job growth is among the fastest of any state. But some weakness in quality of life, particularly when it comes to health, could make it difficult to attract and retain talent. And by the numbers, Georgia can be stingy with incentives. Population: A+ Stability: B+ Talent: B Location: C+

AUSTIN

Overall Grade: A- Texas seems to have many attributes that align well with Amazon's needs. No state has a better infrastructure, and the state's business climate is the picture of stability, thanks to the nation's best all-around state economy. Austin offers not only those attributes but also a legendary tech scene fed by the state's flagship university and a vibe that tech talent can love. Texas does have some quality-of-life issues when it comes to crime, health insurance and inclusiveness. And while the state gets points for having no corporate income tax, high property taxes cancel out some of that cost advantage. Population: A+ Stability: B+ Talent: B Location: A

BOSTON

Overall Grade: B+

Heavy traffic on a Thursday in Boston, Massachusetts. Jim Davis | The Boston Globe | Getty Images

If Amazon's biggest priority for its new location is the workforce, Boston has a compelling story to tell. Massachusetts workers are among the highest educated in the nation, and no state gets better results from its workforce training programs. But anyone who has tried driving in the city's notorious traffic knows that the infrastructure leaves plenty to be desired. Combine that with the very high cost of doing business, and it means Boston will have to be especially creative in order to meet Amazon's location needs. Population: A+ Stability: B Talent: A- Location: C

CHICAGO

Overall Grade: B- The Windy City seeks to reclaim a part of its heritage by winning Amazon's HQ2. This, after all, was the home of Sears and Montgomery Ward — the Amazons of their day. Chicago does have a lot going for itself, including some of the world's most prestigious universities, such as Northwestern and the University of Chicago. It is a transportation hub, including O'Hare International Airport, which is set to undergo an $8.5 billion expansion. But Illinois is the antithesis of stability and business-friendliness. Population: A+ Stability: D- Talent: B- Location: B

COLUMBUS, OHIO

Overall Grade: B

The Ohio State University, commonly referred to as Ohio State or OSU, is a public research university located in Columbus, Ohio. Getty Images

Columbus may well have made the list of finalists thanks to its brain power. The Ohio State University is one of America's most prestigious institutions — and no, we are not talking about the football team. It is also a magnet for research funding. But Ohio struggles a bit when it comes to the quality of life that tech talent craves. The state leaves some business friendliness to be desired when it comes to regulation. Air travel options can be limited. Population: A+ Stability: C- Talent: B- Location: B+

DALLAS

Overall Grade: A- Dallas offers the same Texas advantages that Austin does — great infrastructure, a strong and stable economy, and a world class workforce. It also offers more air travel options. Dallas–Fort Worth International Airport is the world's fourth busiest based on aircraft operations, serving 233 destinations including 57 international cities. But Dallas also shares Texas' disadvantages when it comes to quality of life and cost. Plus it suffers a relative shortage of science, technology, engineering and math (STEM) workers that companies like Amazon crave. Population: A+ Stability: B+ Talent: B Location: A

DENVER

Overall Grade: B+

Denver's economy is solid, and it has a strong, educated workforce. It also has the nation’s fourth-largest concentration of science, technology, engineering and math (STEM) employees. photoquest7 | iStock | Getty Images

The Mile High City offers many similarities to Amazon's current home, Seattle. Both cities' population and demographics are almost identical, and so are their overall vibes. That may not be foremost on Amazon's checklist, but it probably does not hurt. Also working in Denver's favor are a strong and relatively stable business climate, a great workforce that is chock full of tech talent, and one of America's top airports. But Colorado's strong economy has left the state with severe worker shortages, contributing to the high cost of doing business. Population: A+ Stability: B+ Talent: A- Location: B-

INDIANAPOLIS

Overall Grade: B Indiana claims to be the Crossroads of America, and if Amazon chooses to build its new headquarters there, it would be hard to dispute that. The state capital provides a wholesome, heartland life at a fraction of the cost of most metropolitan areas its size. Indiana offers a stable economy, and it is nothing if not business-friendly. Roads are great, and commuting is a breeze. Its costs are among the lowest of any big city in the country. But air travel options are limited, with just two flights a day to Seattle, and international flight destinations limited to Paris, Cancun and the Dominican Republic. Quality of life can leave something to be desired, and the workforce ranks in the bottom 10 for educational attainment. Population: A+ Stability: B+ Talent: D+ Location: B

LOS ANGELES

Overall Grade: B

Gerald French | Getty Images

Some were surprised that L.A. made it to the finals, particularly those who believe Amazon wants to expand its corporate presence beyond the West with its new headquarters. But the company has never said that geography was part of its selection process. If it is not, there is plenty to argue for the City of Angels. Home to the burgeoning Silicon Beach tech scene, L.A.'s workforce is top-notch. No state has more higher-education institutions than California. They are turning out droves of STEM workers who are happily staying in the Golden State. But the state is hardly business friendly when it comes to regulation, it is expensive, and a little time on an L.A. freeway will tell you most of what you need to know about the infrastructure. Population: A+ Stability: C Talent: B+ Location: C+

MIAMI

Overall Grade: B+ If Amazon is serious about expanding its presence in Latin America—it already opened a new office in Buenos Aires this year—a Miami headquarters makes perfect sense. Few places offer more air travel options, with hundreds of flights each day from Miami, Fort Lauderdale, and West Palm Beach. A wealth of colleges and universities feed the talent pool, though STEM workers are in short supply. Florida's economy is relatively strong and stable. But high crime and poor health hurt the quality of life. Population: A+ Stability: B+ Talent: C+ Location: B+

MONTGOMERY COUNTY, MARYLAND

Overall Grade: B-

Rockville is a city located in the central region of Montgomery County, Maryland. Denis Tangney Jr. | Getty Images

Montgomery County is one of the three locations in and around the nation's capital that are on Amazon's short list, a nod to the region's high-caliber workforce — Maryland boasts the highest concentration of STEM workers of any state — and its booming economy. But Maryland's regulatory climate can be tough. Maryland also has serious infrastructure woes, and it can be prohibitively expensive, with some of the highest wage costs in the country. That helps explain why the state has offered Amazon an $8.5 billion incentive package — the largest HQ2 offer, at least among those that have been disclosed. Population: A+ Stability: C Talent: B- Location: C-

NASHVILLE

Overall Grade: B+ Music City is the picture of stability and business friendliness. Tennessee state finances are solid, the economy is growing, and regulation is accommodating. The infrastructure is solid, and costs are low. However, crime, poor health, and a relative lack of inclusiveness in state laws could hurt Nashville's ability to attract and retain talent, which may already be evidenced by a severe shortage of STEM workers Population: A+ Stability: A- Talent: C- Location: B+

NEW YORK

Overall Grade: B-

Billboards in Times Square, New York City Joecho | Getty Images

New York State was the most improved state in our 2018 Top States rankings, and much of that had to do with New York City. The Big Apple is an increasingly powerful magnet for tech talent. Higher education is plentiful, there is lots to do, and while the city's airports need some work, there is no shortage of options for travel. But the rest of New York's infrastructure is a mess. The city is notoriously expensive, and businesses face a tangle of red tape. New York State has tried to make up for some of that with the most lavish business incentives in the nation, though it is unclear whether the Empire State is prepared to match the $7 billion being offered to Amazon if it locates across the Hudson River. Population: A+ Stability: D+ Talent: B- Location: B-

NEWARK, NEW JERSEY

Overall Grade: C+ New Jersey raised eyebrows with its offer of at least $7 billion to lure HQ2 to Newark, a package developed and signed into law by former Gov. Chris Christie. His successor, Phil Murphy, agreed to stick with the deal as well. Will it sway Amazon? The company would have to look past New Jersey's high costs, crumbling infrastructure and sometimes oppressive business regulations. If it can do that, it will find a high-quality workforce with a large concentration of STEM workers. New Jersey is giving Amazon 7 billion reasons to think about it. Population: A+ Stability: D Talent: B- Location: D

NORTHERN VIRGINIA

Overall Grade: B+

Northern Virginia Cameron Davidson | Getty Images

Another of Amazon's options for the D.C. area is Northern Virginia, an area that has regained much of its competitive swagger as federal government spending in areas like defense have recovered. Virginia businesses are benefiting from a bipartisan push to cut regulations. Combine that with a strong economy, and the Old Dominion is enjoying renewed stability. Virginia's workforce is world-class, with much less of a union presence than in Maryland or the District of Columbia. The state has been working for several years to improve its infrastructure, but commuting times can still be rough. Population: A+ Stability: B+ Talent: A- Location: B-

PHILADELPHIA

Overall Grade: B- The City of Brotherly Love offers Amazon an East Coast presence without some of the hassles of a city like New York. Pennsylvania is full of colleges and universities, all happy to supply the skilled workers Amazon needs. The state is fighting in court to keep the details of its offer of incentives for HQ2 a secret, but in the past, Pennsylvania has been especially generous with tax breaks and subsidies to businesses. That could help to cancel out Philly's high costs, though it would not help with quality-of-life issues, particularly involving environmental quality. Population: A+ Stability: C- Talent: B- Location: B-

PITTSBURGH

Overall Grade: B- Long known for its transformation from a dying steel town to a new economy wonder, HQ2 could seal Pittsburgh's modern-day reputation. Like Philadelphia, Pittsburgh offers easy access to a wide range of higher education, including the University of Pittsburgh, Carnegie Mellon and Duquesne in town, and Penn State a couple hours away. Pennsylvania's economy is on the lackluster side, which hurts the stability of both Pittsburgh and Philadelphia. Among the weak spots is job growth, the third lowest in the country statewide. Amazon could change that, or so the Keystone State hopes. Population: A+ Stability: C- Talent: B- Location: B-

RALEIGH, NORTH CAROLINA

Overall Grade: B One corner of the famed Research Triangle, Raleigh has been attracting top technical talent for decades. But it has also been attracting unwanted attention for its relative lack of antidiscrimination protections. The state repealed the most controversial provisions of its so-called "bathroom bill," and Gov. Roy Cooper has signed executive orders aimed at promoting inclusiveness. The political environment in North Carolina these days is anything but stable, but a strong economy helps to balance things a bit. Population:A+ Stability: B+ Talent: B Location: C+

TORONTO

Overall Grade: B-

Canadian flag and the Toronto skyline. Roberto Machado Noa | LightRocket | Getty Images

Locating HQ2 north of the border would create some cost advantages for Amazon — at least for now — thanks to the strength of the U.S. dollar. Plus, Ontario has a long history of generosity when it comes to business incentives. Canada's federal corporate tax rates were among the lowest in the G-7 for years — privately-owned small businesses pay as little as 10 percent; others pay 15. Ontario tacks on another 11.5 percent. While there are concerns up north that U.S. tax reform has wiped out Canada's competitive advantage, the economics of a Toronto headquarters are hard to ignore. The city also has a strong, well-educated workforce, though it is heavily unionized, and inclusiveness is enshrined in federal law. There are issues, however. Business regulation is sometimes harsh, the economy is sluggish, and infrastructure needs work. And one can only imagine the presidential tweets over such a move. Population: A+ Stability: C- Talent: C+ Location: C+

WASHINGTON, D.C.