ために vs ように: two ways to say "in order to"

ために (tame ni) is for goals you control; ように (you ni) is for outcomes you can only aim at. The rule, with the verb forms that decide it.

ために (tame ni) and ように (you ni) both translate as "so that" or "in order to". The choice depends on whether the goal is something you do or a state you hope to reach.

The short version

ために ように
Goal an action you control (volitional) a state or result you cannot just decide
Verb before it dictionary form of a volitional verb potential form, ない form, or verbs like 分かる, 見える, 聞こえる, なる
Subjects usually the same in both clauses can differ
Example 日本で働くために、日本語を勉強している。 日本語が話せるように、毎日練習している。

The quick test

Look at the verb in front:

ために has two more jobs

Related patterns built on ように: 〜ようにする (make a habit of) and 〜ようになる (come to be able to).

Study the points: 〜ために · 〜ように · 〜ようにする · 〜ようになる