Origin of "Fits [x] to a T"?
Solution 1:
According to the Oxford English Dictionary, the exact origins of the phrase to a T are unknown:
The original sense of T here has not been ascertained. Suggestions that it was the tee at Curling, or at Golf, or a T square, appear on investigation to be untenable; it has also been suggested that it referred to the proper completion of a t by crossing it (see 1b); or that it was the initial of a word; in reference to this it is notable that to a tittle (i.e. to a prick, dot, jot) was in use nearly a century before ‘to a T’, and in exactly the same constructions: see tittle n.
So, it is possible that the use is not referring to the use of a tee when building something. The Phrase Finder agrees that there is no accepted derivation, but offers the following:
Given Wright's earliest 'to a T' usage and the lack of evidence to support the 'tee' version, it is safe to assume the proper spelling is 'to a T'. So, what T was meant? Again, there are alternatives; 'T-shirt', or 'T-square', or some abbreviation of a word starting with T.
'T-shirt' is clearly as least 300 years too late, has no connection with the meaning of the phrase and can't be taken as a serious contender.
'T-square' has more going for it, in that a T-square is a precise drawing instrument, but also lacks any other evidence to link it to the phrase.
The first letter of a word. If this is the derivation then the word in question is very likely to be 'tittle'. A tittle is a small stroke or point in writing or printing and is now best remembered via the term jot or tittle. The best reason for believing that this is the source of the 'T' is that the phrase 'to a tittle' existed in English more than a century before 'to a T', with the same meaning.
When there isn't a definitive origin and there are several proposed derivations, the wisest course is to list the possibilities and leave it at that. In this case, although there is no smoking gun, the 'to a tittle' derivation would probably stand up in court as 'beyond reasonable doubt'.
So the OED and Phrase Finder agree that the most likely etymology is that the phrase to a T comes from to a tittle. There is also the phrase:
to a tittle, with minute exactness, to the smallest particular, to a T.
Solution 2:
A tee is a right angle instrument used to draw and measure square corners in building and carpentry.
When you carve a square stone to build your medieval cathedral (or cut drywall to build your garage) you test it is square by holding up the tee to it.
Solution 3:
OED says that you can spell it as to a T or to a tee. As was already mentioned, no one knows for sure where it came from.
Phr. to a T (also to a tee): exactly, properly, to a nicety.
1693 Humours & Conversat. Town 102 All the under Villages and Towns-men come to him for Redress; which he does to a T.
1700 Labour in Vain viii, in Harl. Misc. (1810) X. 473 Harry cajoled my inquirer, and fitted his humour to a t——.
1771 J. Giles Misc. Poems 155 I'll tell you where You may be suited to a tee.
1815 Zeluca I. 385, I knew my man to a T.
1828 Life Planter Jamaica 161, I understand the practice to a tee.
1856 H. B. Stowe Dred ii, All these old-fashioned goings on would suit you to a T.
Solution 4:
The earlier phrase "to a tittle", of which "to a T" is apparently a shortened form, would seem to be derived from King James bible (originally translated in 1611, and by the end of that century the most widely used English language bible).
Matthew 5:17-18
17 Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil.
18 For verily I say unto you, Till heaven and earth pass, one jot or one tittle shall in no wise pass from the law, till all be fulfilled.
Luke 16:17
17 And it is easier for heaven and earth to pass, than one tittle of the law to fail.
Read these passages in context
Christ's meaning in these passages is obvious; the Hebrew scriptures must be fulfilled completely - in every minute detail - and he was there to do so. You could say he fit their law "to a T".