To a t (or To a tee)

Perfectly or exactly right.

For example, if something suits you to a T, it suits you perfectly and if you have an activity or a skill down to a T, you have mastered it.

The origin of the idiom is uncertain, even whether the “t” or “tee” comes from a sporting reference (both golf and curling have a tee) or even whether it was originally “to a tea”!