The moment you learn the reason behind something you'd noticed, 难怪 (nánguài) clicks it into place: 他病了,难怪今天没来上课 "he's sick — no wonder he didn't come to class". 怪不得 (guàibude) means exactly the same and sounds a touch more colloquial.
It normally comes AFTER the reason, often one introduced by 原来 "so it turns out": 原来你是老师,难怪你的中文这么好. The observation that follows is old news to you — 难怪 just announces that the mystery is solved.
Examples
他病了,难怪今天没来上课。
他病了,難怪今天沒來上課。
tā bìng le nán guài jīn tiān méi lái shàng kè
He's sick — no wonder he didn't come to class today.
原来你是老师,难怪你的中文这么好。
原來你是老師,難怪你的中文這麼好。
yuán lái nǐ shì lǎo shī nán guài nǐ de zhōng wén zhè me hǎo
So you're a teacher — no wonder your Chinese is so good.
外面在下雨,怪不得这么冷。
外面在下雨,怪不得這麼冷。
wài miàn zài xià yǔ guài bù de zhè me lěng
It's raining outside — no wonder it's so cold.
他昨天没睡好,难怪这么累。
他昨天沒睡好,難怪這麼累。
tā zuó tiān méi shuì hǎo nán guài zhè me lèi
He didn't sleep well yesterday — no wonder he's so tired.
Common mistakes
✗ 难怪他为什么没来。
✓ 难怪他没来。
难怪 already carries the "why" — don't add 为什么 after it.
Every grammar point in this guide is built into the Literate Chinese app, with graded stories that use the pattern naturally and flashcards matched to the words you know — in Mainland or Taiwan Mandarin. Free on iOS and Android.