to (do something); in order to
Uses のに to express the purpose or goal of an action, meaning 'in order to'.
のに is used to state the purpose or objective of an action. It answers the question 'for what purpose?' and is often translated as 'in order to' or 'to'. The sentence structure is: [Purpose/Goal] + のに + [Action taken]. The action is done to achieve the purpose. For example, in 料理を作るのに時間がかかる, the purpose is 'making food' and the action is 'time is taken'.
This のに is different from the one meaning 'although' or 'even though', which attaches to the plain past or plain non-past form and connects contrasting clauses. Here, the meaning is purpose, so it often appears after the dictionary form of a verb. It is commonly used in explanations about what is necessary or useful for a certain goal, such as 勉強するのに辞書が必要だ (a dictionary is necessary for studying).
Note that のに in this sense is neutral in formality and can be used in both speaking and writing. It is a standard pattern for N4 learners.