What you pay at settlement can be expensive. Be sure the shop around before you purchase your home. (MariuszBlach/Getty Images/iStockphoto)

In the emotional rush that precedes buying a home — negotiating contract details and price, beating away rival bidders, searching for the best mortgage deal — closing costs often aren’t a pressing concern. Yet what you pay at settlement can be surprisingly expensive, even a budget buster.

Would you believe that the average buyer of a single-family home in Kings County, N.Y. — better known as Brooklyn — got hit with $57,333 in closing costs at settlement during the past year? Or that the average buyer of a home in the District shelled out more than $20,000?

Ouch! Granted, the average cost of the houses was between $900,000 and $1 million in Brooklyn and close to $800,000 in Washington. In both cases, the largest component of the closing bill was transfer taxes imposed by the local government — a stunning $50,189 in Brooklyn, $14,022 in D.C.

Then there’s Maryland’s Montgomery County, where the average buyer paid $22,181 in settlement fees; Philadelphia ($16,463); Los Angeles ($10,991); Miami ($9,364) and Cook County, Ill. (the Chicago area, $7,085).

All these figures come from a new compilation of what buyers pay for closing services and taxes in the 50 states and the District, plus hundreds of counties and “core” metropolitan statistical areas. The study was conducted by ClosingCorp, a data and technology company for the real estate industry. It covered more than 900,000 home-purchase transactions that went to settlement between October 2017 and March of this year.

The study’s primary focus: measuring the fees charged for the services typically involved in closings — title insurance (lenders’ and owners’ coverage), appraisals, recordation, land surveys, settlement charges — plus transfer taxes. The variations buyers can encounter are eye-opening.

On a national basis, the average-priced single-family home purchased during the study period cost $318,362. The average appraisal charge was $526; lender’s title insurance policy, $1,282; owner’s title insurance, $517; and recording fee, $197. The settlement fee charged by the agent or attorney administering the closing came to $916. Real estate transfer taxes added $3,438, and the total for all services plus taxes came to $5,651.

Depending on where you live, $5,651 in closing fees might strike you as low, reasonable or ridiculously high. For example, if you lived in Pottawattamie County, Iowa, where home prices average a little more than $149,000, you would have paid just $1,821 when you closed on your house. That included all the regular services — such as title, appraisal and surveys — plus $117 in taxes. Pretty cheap. You’d also probably feel you’re getting a good deal in Tippecanoe, Ind., where the closing charges on your $133,000 home came to $2,029, with zero transfer taxes.

But real estate is all about location, and when the location is in or close to a big city or along the East or West coasts, you tend to have to pay a lot more — for the house, for settlement fees and taxes. So it’s not surprising that the highest average total closing fees, including taxes, are in the District ($20,228), New York ($15,254), Maryland ($13,358), Delaware ($13,293) and Pennsylvania ($10,206). Removing taxes from the equation, D.C. is still the highest-cost “state” in the country with average closing-service fees of $6,206. Excluding taxes, Hawaii is second-most-expensive, California is next at $5,276, followed by New York ($4,915) and Washington state ($4,860).

But focusing on dollar amounts paid at settlement is not the only useful way to look at closing costs. High-priced housing markets will almost always be expensive at closing. But here’s an alternative way to look at it: Putting aside local tax levies, what portion of a home-sale price is paid for actual services rendered — such things as title insurance, surveys, appraisals, and the money paid to the attorneys or agents who conduct the closing? Analyzing it this way allows you to gauge the costs of the services themselves relative to the price of the house.

By this measure, Pennsylvania turns out to have the highest closing charges: 1.91 percent of average home price. Illinois is second at 1.85 percent, Michigan comes in at 1.69 percent, Oklahoma at 1.62 percent, and Ohio at 1.5 percent. Also using this measure, some of the highest-housing-price areas look like bargains: D.C. closing fees represent just 0.81 percent of the average home sale price; California, 0.80 percent; and Massachusetts, 0.83 percent.

Bottom line: Check out local closing-cost variations before you purchase. Thousands of your dollars are at stake.

Ken Harney’s email address is harneycolumn@gmail.com.