To the nines is an idiom, usually used as an adverb, that means the action is done perfectly or to an extravagant extent. The British English version is up to the nines.
The phrase itself dates back to the 1700s. It was used in the sense that something made someone so happy it was to the nines. Beyond this example, no one is quite sure how the phrase originated, though there are some guesses it had a French language influence. However, that conjecture is simply a guess and has nothing to do with the number nine.
In today’s usage to the nines is seen and read most often with the verb dressed. If someone is dressed to the nines he or she is extravagantly or perfectly dressed for the occasion.
But everything else is choreographed to the nines as well, such that the wailing Leanne Klingaman throws herself around the stage in the throes of despair like a wailing dervish; Suzanne Warmanen is an absolute storm as the wisest person on stage, the maid Dorine, who shakes and waves her fist as she bellows her truth. [Broadway World]
All the usual suspects were there and dressed to the nines, alongside many of the visionaries responsible for their coveted couture. [Forbes Life]
“If this was anywhere else in Canada it would be built to the nines, they would have soldiers down there in period costumes and there would be lots of activity,” he said. [CBC]