http://www.hostelworld.com or http://www.travelpod.com that also offer reviews ranging from “cheap and worth it” and “Excellent! Je recommande!” to “the owner of this place should be in prison” and “it is a crack den full of criminals, bed bugs, prostitutes, and mental patients.”

It’s a booming business. But is it legal?

It’s not always clear. Last week, the city raided a commercial building on N. Sixth Street that contained two such hostels, though one, Zip112, was allowed to remain open, while Loftsel was shuttered.

This week, city officials acknowledged that they simply do not know whether dozens of hostels in Williamsburg and Greenpoint are operating within the law.

A Williamsburg Courier investigation uncovered 12 hostels operating in the neighborhood. Most of the buildings in which the hotels exist did not have a certificate of occupancy and several of those buildings had violations for allegedly illegal construction work.

According to city codes, a hostel is legal if its building is located in an area that is zoned to allow the hostel to operate and the manager has the proper permits to run the lodge.

The building must also have an amended certificate of occupancy signifying the intended use of rooms in the building and additional safety measures to accommodate the population living in the property.

“What this comes down to is that the people who are renting out these rooms are putting themselves at risk if there aren’t adequate fire safety measures,” said Department of Buildings spokeswoman Carly Sullivan. “You don’t want a scenario that is unsafe for people to stay there.”

Sullivan did say that the bottom line is that any loft could be converted into a hostel — provided the permits and safety measure are in place.

In the wake of last week’s raid on N. Sixth Street, city inspectors fanned out across the neighborhood, following up on multiple complaints about illegal hotels, though records show that inspectors were unable to access the buildings to determine whether hotels were present.

Complaints from residents and businesses share a common theme: anxiety towards the transient population in its midst.

One tenant who rented an apartment in the N. Sixth Street building said she feared for her safety whenever hostel guests came back to their room after a night of partying. Eight blocks away, a salon owner near the unmarked Williamsburg HostL on Bedford Avenue and S. Second Street has been repeatedly interrupted by tourists who wander into her store, asking where the hostel is.

“They’re running a business, they’re collecting money, and they’re doing it illegally,” said the salon owner.

Another Williamsburg tenant, who signed a one-year lease in a converted factory loft off Driggs Avenue and S. Fifth Street, is worried that his building is now the headquarters of a chain of hotels that are part of the growing Hotel Toshi empire.

Best known for his work as a recurring character on “Late Night with Conan O’Brien,” actor and promoter Robert “Toshi” Chan manages 48 apartments in 18 buildings in Manhattan and Williamsburg. The underground hotel consists of scores of luxury lofts at prices as low as $100 a night, a stark contrast to the homely but cramped quarters of most Williamsburg hostels.

Yet Chan’s building on S. Fifth Street received 20 violations from the city while his S. Eighth Street flagship received five violations for unpermitted construction work. A city inspector this week referred the investigation to the Mayor’s Office of Special Enforcement to further pursue the matter.

“I’ve spoken to two other permanent residents since I moved in but we all feel like there’s a big security concern due to all the transient people here,” said one tenant. “Until the laws change in our favor, we’re all at the mercy of the hotel and Toshi Chan.”

For tourists visiting Williamsburg, the hostel experience is a different story. At the New York Loft Hostel, a legal lodge that received some of the best reviews on travel Web sites, guests mostly felt they got what they paid for, which was a hassle-free stay in a convenient location.

“We were looking at all places in Brooklyn, but everyone says Williamsburg is the best. There are a lot of students and workers our age here,” said Jenny Daly, 19, from San Francisco.

Having the proper certification and permits did not stop city buildings inspectors from visiting the law-abiding hostel, issuing 18, mostly minor, violations.

As the city expands its investigation into hostels and hotels, others continue to proliferate. For community leaders, including Assemblyman Joseph Lentol (D–Williamsburg), that is not necessarily a bad thing as long as hospitality businesses are legal and follow city codes. The danger is if a hotel manager is using a building illegally, an ensuring city raid could leave legal residents homeless.

“[The raid on N. Sixth Street] is just one example of how people … can get hurt by that,” said Lentol.