Chips are at the foundation of every digital technology. Whether it's a smartphone, electric vehicle, or laptop, they are filled with chips, making this technology one of the most important products in the supply chain. As a result of their necessity, the companies behind them have significant pricing power, making them fantastic investments.

Two chip stocks that look like great buys now and are critical to the chip supply chain are Taiwan Semiconductor (TSM 1.26%) and ASML (ASML 2.04%). With each stock trading an attractive valuation and plenty of tailwinds on the horizon, these two could be portfolio-changing investments.

China is a risk for both companies

Taiwan Semiconductor and ASML are not competitors. Instead, ASML supplies its EUV (extreme ultraviolet) and DUV (deep ultraviolet) lithography machines to Taiwan Semiconductor so they can etch microscopic patterns onto the chip.

The latest and greatest in chip design is a 3nm (nanometer) chip, which means the distance between transistors is at a minimum of 3nm wide. For reference, a human hair is between 80,000 and 100,000 nanometers wide.

While only a handful of companies can manufacture 3nm chips (Taiwan Semiconductor being one of them), only one creates the machines that make this technology possible: ASML. This makes these two companies fantastic investments based on their technological capabilities.

However, there's one overarching threat to both companies: China.

While the China invasion worries over Taiwan have died down, it is still a real possibility. Any action against Taiwan would sink Taiwan Semiconductor's stock (along with almost every other stock that uses Taiwan Semiconductor chips, like Apple and Nvidia). So avoiding TSMC because of this worry isn't wise, as iPhones and GPUs that power much of our computing infrastructure would have a part shortage and tank the market in general.

ASML also has to deal with China bans, as the Dutch government doesn't want the company to export its top-end EUV machines to China. So, ASML sends China its DUV machines, which are less powerful and can only produce chips 7nm in size. There is always a possibility that ASML may be prohibited from exporting any of its products to China, which would be an issue, as 46% of ASML's Q3 and 24% of Q2's new machine sales came from China.

This makes China a large part of the investment risk for both companies, but with how destabilized the world's economy would become if an attack happened, I don't think it's a valid reason not to invest. However, it's something to keep an eye on.

Despite these risks, both stocks look like strong buys right now.

Trading at recent valuation lows

If you look at each company's price-to-earnings (P/E) ratio at face value, it may appear Taiwan Semiconductor is far cheaper than ASML, which is true. However, Taiwan Semiconductor is a cyclical business, as demand for its chips rises and falls based on consumer appetite. Planning and ordering machines from ASML takes some time, so it isn't as affected by consumer trends. For example, ASML's revenue backlog (for machines already ordered) sits at 35 billion euros, compared to Q3 system sales of 5.3 billion euros.

As a result, ASML has a higher valuation, which it has rightfully earned.

ASML PE Ratio Chart

ASML PE Ratio data by YCharts

Both companies are trading well below their five-year historical average P/E ratio, which tells me each stock is undervalued in its own right.

With each company slated to capitalize on a chip boom that artificial intelligence (AI) computing creates, I think each stock is a buy right now. But if you forced me to pick one, I'd likely side with Taiwan Semiconductor because of its lower starting valuation.