Break-even: the number that decides it
Break-even months = closing costs ÷ monthly payment saving. Refinancing $300,000 at 6.5% down to 5.75% over 30 years saves about $143 a month; with $4,000 of costs, that is roughly 28 months before you are ahead.
If you might sell, move or refinance again before that point, the lower payment never pays for itself.