The information you are seeking is readily avaiable from your Realtor or from your real estate attorney. I've provided a link to an attorney's website regarding nyc and nys tax rates on the transfer of property.
Ute, listed most of the fees, but there's also a mansion tax - 1% of the sale price - when the sale is $1 million or more. There are also loan closing costs, but you'll have to consult your lender for these. Add attorney's fees, prepaid maintence, common charges and deposits to the building and insurance for your apartment.
As far as actual closing costs, your attorney should be able to give you an estimate.
If you already have already determined the purchase price your real estate attorney will be the only person who can provide you with a good estimate of the closing costs. Your accountant - once familiar with the terms of the sale - can tell you about any possible capital gains implications. The Realtors here are (myself included) are not qualified to give advise on this unless they are also CPAs.
You have yourself listed as a buyer and a seller, so those are two different circumstances?
As Ute mentions your lawyer ought to be able to provide with the closing cost information and if you are still shopping, with additional info from your agent, a rough estimate of the closing costs.
As you mention capital gains, I suppose you are asking as a seller. In either case I hope you have your own attorney (not the buyer's) that specializes in NYC real estate as there are many unique factors to NYC Real estate closings. I mention that because many years ago my great-aunt was induced by an unscrupulous real estate agent, to sell a valuable piece of property ( in another area) and to use the buyer's attorney and did not receive the proper advice. Please let me know if you would like a list of reputable Manhattan real state attorneys.