The ideal length of dress socks should be up to just below the knee, as shown in the picture below.
However, these days very few manufacturers make these proper length socks. Nonetheless, I would recommend that your wardrobe should include a few pair of these socks for very formal occasions. The common ones available in the market are shown below:
Please remember that the color of your socks must match the color of your trousers, unless your trousers are white. If your trousers are white, the color of the socks should match the color of your shoe.
Never wear white socks with formal wear—white socks are only for sports.

