The break-even formula
Break-even months = closing costs รท monthly payment savings. If you keep the loan past that month, the refinance has paid for itself in cash flow. Also check lifetime interest. Restarting a 30-year term can lower your payment and still cost more overall.
Worked example
You owe $300,000 at 7% with 27.5 years left, so you pay $2,050.85 a month. Refinancing into a new 30-year loan at 6% costs $6,000 and drops the payment to $1,798.65, saving $252.20 a month. Break-even comes after about 24 months. Over the life of the loan you save about $23,265 in interest after costs, even with the longer term.