It’s usually better to replace the entire window for optimal energy efficiency and ease of installation. New window frames also provide much better insulation.