国外 (guówài)
Meaning: Abroad, foreign countries
国外 literally means “outside the country.” It is used to refer to any place that is outside one’s own country, and it doesn’t necessarily imply crossing an ocean or sea. It is a more general term.
e.g.
他在国外留学。(Tā zài guówài liúxué.) He is studying abroad.
你去过国外吗?(Nǐ qù guò guówài ma?) Have you been abroad?
海外 (hǎiwài)
Meaning: Overseas
海外 literally means “beyond the sea.” It is often used to specifically refer to places that are across the sea or ocean, implying a greater distance from one’s own country. It is sometimes used in a broader, more cultural or economic sense, such as referring to overseas Chinese communities (海外华人) or overseas investments.
e.g.
他有很多海外朋友。(Tā yǒu hěn duō hǎiwài péngyǒu.) He has many friends overseas.
海外市场对我们很重要。(Hǎiwài shìchǎng duì wǒmen hěn zhòngyào.) The overseas market is very important to us.
Summary
国外 is a more general term for “abroad” and can refer to any foreign country, regardless of geographical location relative to seas or oceans.
海外 specifically refers to places “overseas,” often implying a geographical separation by water and sometimes used in contexts related to international business, culture, or diaspora.