adverb
while one is at it; incidentally; on the occasion of
Used when doing something extra or additional while already engaged in another activity, or when taking the opportunity to do something. Often translates to 'while I'm at it', 'on my way', or 'by the way'.
買い物に行くなら、ついでに郵便局に寄ってきて。
If you're going shopping, stop by the post office while you're at it.
Incidentally, tomorrow's meeting has been canceled.
出張のついでに観光もしてきた。
I did some sightseeing while I was on my business trip.
ちなみに is used to add related but separate information, like 'by the way', without implying the action is done alongside another task. ついでに emphasizes doing something extra during an existing activity or opportunity.
Derived from the noun 序で (ついで, 'order' or 'opportunity') + the particle に. The exact historical development is uncertain, but it has been used adverbially since at least the Edo period.