Question: when is ihnen used in german?
Answer: Both can be translated as "you" but "dir" is used in informal situations and "Ihnen" is used in formal situations. You would use "dir" if you speak to a friend or a family member. "Ihnen" is used if you talk to unknow people, your boss, your teacher for example.