ために vs ように: expressing purpose ('in order to') in Japanese
Use ために for an intentional aim or beneficiary and ように for a desired state, ability or prevention. Compare natural B1 purpose sentences.

In short
Use ために for an intentional aim that the actor works towards, typically with the same actor in both clauses. Use ように for a desired state, ability or prevention, especially with potential and negative forms; noun + のために expresses a purpose or beneficiary.
合格するために、毎日勉強しています。
丁寧語 politeI study daily in order to pass.
The speaker has adopted passing as a goal.
日本語が話せるように、毎日練習しています。
丁寧語 politeI practise every day so that I can speak Japanese.
Potential 話せる describes the desired ability.
忘れないように、予定をメモします。
丁寧語 politeI make a note of my schedule so that I will not forget.
A prevented event is framed as a desired negative state.
| Aim | Construction | Example |
|---|---|---|
| Volitional action | Plain non-past verb + ために | 本を買うためにお金を貯める。 |
| Beneficiary or noun purpose | Noun + のために | 家族のために料理する。 |
| Ability or state | Plain verb + ように | 後ろの人にも聞こえるように話す。 |
The same-subject and volition rules are useful defaults, not absolute syntax bans. A negative or potential can occur before ために when the result is conceptualised as an intended objective, for example 事故を起こさないために点検する. ように is especially useful when the outcome is not directly controllable or has a different subject. Do not confuse purpose with causal ため: 雪のため、電車が止まりました reports the cause of an interruption, not its goal.
Practise the specific constructions
To practise the contrast, describe preparing for a seminar: 発表するために資料を作る gives the aim; 聞き手にも分かるように図を入れる describes a desired outcome for listeners. Both can occur in the same account without conflict.