This is a major point of confusion for learners. While they can sometimes overlap, they have distinct primary meanings.
幸好 (xìnghǎo): Means “fortunately” and expresses relief that a potential bad thing was avoided. It's about a near-miss.
还好 (hái hǎo): Primarily means “so-so,” “passable,” or “it's alright.” It describes a state of being merely acceptable, not great.
Common Mistake: Using `幸好` to describe something as “okay.”
Subtle Overlap: When `还好` means “fortunately,” it often describes a situation that is bad, but “not as bad as it could have been.” `幸好` focuses more on the *reason* for the good outcome.
还好,他只受了点轻伤。 (hái hǎo, tā zhǐ shòu le diǎn qīngshāng) → “Fortunately, he only suffered minor injuries.” (Focus on the state: the injuries aren't severe).
幸好,他系了安全带。 (xìnghǎo, tā jì le ānquándài) → “Fortunately, he wore a seatbelt.” (Focus on the cause that prevented a worse outcome).
`幸好 (xìnghǎo)` vs. `幸亏 (xìngkuī)`
These two are very close synonyms and are often interchangeable. The difference is subtle.
幸亏 (xìngkuī): Can carry a slightly stronger sense of “thanks to…” It often implies that a specific person, action, or thing is the direct cause of the good fortune.
Example: 幸亏有你帮忙,不然我肯定完不成。(Thanks to your help, otherwise I definitely couldn't have finished.)
In the sentence above, `幸好` would also be correct, but `幸亏` places a bit more emphasis on “you” as the hero of the situation. You can think of `幸好` as a general statement of luck, and `幸亏` as luck that you can often point a finger at.