For the whole house remodel we are working on we replaced all the existing 110 year old windows and doors. Since we gutted the entire house it was easy to install the new windows and doors and insulate with spray foam insulation around the entire perimeter.
When installing replacement insert windows it is not as easy to insulate the window properly as in a full window replacement. It does make for a better job and a noticeably more comfortable home when the replacement insert windows are insulated with spray foam insulation between the existing window jamb and the framing.
To do this we remove the old sashes and window weights, if any, drill a 1″ hole through the existing window jamb every 10″ and fill the cavity a little at a time until the foam expands out of the hole. Once done we install the new insert, spray foam again between the new insert and the existing jamb and trim the insert out.
This method takes a little longer but it creates a really tight window and a less drafty house.