Use when used in to state the condition under which something applies, followed by a noun naming a place or context.
It's a shortened form of when it is used in: This word sounds formal when used in a report.
Pick the wording that matches your sentence
You're writing instructions and want to name the setting where something behaves a certain way. Use it with a place or field: When used in baking, this flour gives a lighter texture.
You're describing a word or phrase and how it lands in a particular kind of writing. The shortened form stands in for when it is used in: This term sounds formal when used in a report.
You're comparing how the same tool performs across two settings, so each clause carries its own result. When used in a laboratory, the device is highly accurate, but when used outdoors it drifts.
You're tempted to attach an action instead of a place, as in when used in cooking dinner. That reads oddly. Name the context itself, when used in cooking, or switch to a different phrase such as when used to prepare dinner.
You're unsure whether the subject matches. The subject of your main clause must be the thing being used, and the participle stays passive: this salt, when used in soups, dissolves quickly, never when using in soups.
The noun after 'in' must be a place or context, not an action
Check whether the word after in names a context such as a place, field, or kind of writing. If it does, the phrase fits: This phrase sounds stiff when used in emails.
If that word names an action instead, as in when used in cooking dinner, the sentence reads oddly. Name the context itself, when used in cooking, or switch the verb: when used to prepare dinner.
Sometimes you can't find any context noun at all. Don't force one in; when used in needs something for the condition to apply to.
In that case, say the action directly with when used to: This herb works best when used to season fish. You can also restructure fully: when you use it in soup.
One quick test: finish the thought with in plus your noun and ask whether it answers where or in what setting, meaning the place or activity where the thing is used. A bare gerund can name that setting: in cooking works, because cooking is the setting for using the tool. If your noun instead pushes the phrase toward doing what, as in when used in cooking dinner, that version reads oddly, and the action wording with when used to is the better fit: when used to prepare dinner.