I will like to know if I need a visa for staying in Bejin for 18 hours transit.

I will be flying from NJ/USA to final destination Ulaanbaatar Mongolia, but I have to stop in Beijin and have to wait 18 hours transit to take next airplane available to Ulaanbaatar Mongolia.  Do I need a visa for staying in a hotel there for 18 hours and how much will be the cost of the closest hotel from Bejin airport?

On paper, the policy seems to be that one can transit through Beijing with no visa but one has to stay inside the secured area of the airport, without going through customs and immigration. The rule is: "Visas are not required of aliens who hold air tickets to the final destination and have booked seats on international airliners flying directly through China, and will stay in a transit city for less than 24 hours without leaving the airport."

On the other hand, there seems to be the practice by which transit passengers are allowed to get out of airport if he can provide documents showing that he is booked to fly out within 24 hours. What happens in this situation is that the transit paseenger goes to a desk, an immigration official will check his documents (passport, boarding pass) and apply a stamp on the passport that serves as a landing permit, with which the traveler can get out and then get back in the airport. Some travelers with have connecting times have made use of this to make a quick run into Beijing. 

One happens here is probably one of those situations where even though something is allowed but the Chinese government does not want to put it clearly on paper as it does not want a lot people to do this. So, "without leaving airport" could mean not leaving the secured area of the airport or not leaving the neighborhood of the airport generally. In the second situation, of course, if one does leave the airport area, there is not way stop him.

Just be prepared for the different senarios. It is likely that you'll be let out of airport. If for some reasons they don't let you go with no transit visa, ask for a transit visa. That will cost you, so hopefully it does not come to that.

As for hotels close to the Beijing Capital Airport, tbe least expensive would be $35-40 a night, with clean and decent room in a two to three star hotel, like Beijing International Aviation Club, Beijing Aulympic Airportel. Hotels in the $50-60 range - Capital Airport Hotel, Beijing Zhong Hang Airport Hotel, Days Inn Business Place Longwan, Beijing Airport GR International Business Hotel, or Days Hotel Beijing New Exhibition Center. These hotels are 5-15 minutes from the airport terminals by bus or taxi.