The geometry of an inductor made of a long thin wire and having the highest possible Q-factor is found by numerical optimization. As frequency increases, the Q-factor first grows linearly and then according to a square-root law, while the cross-section of the optimal coil evolves from near-circular to sickle-shaped.