When I told my roommate that I wanted to get a small flock of backyard chickens, he said OK — then added, “Of course, we’ll have to make sure it’s legal.”

Uh-oh. I was pretty sure it was NOT legal. And he wasn’t willing to break the law.

We’re not alone. Around the country, chickens are gaining popularity as productive pets, and many cities (like Detroit, Iowa City, and Calgary) don’t allow them. More commonly, they allow chickens only on large properties, making the birds effectively illegal for most residents. Here’s what you can do if yours doesn’t give a flying cluck about poultry.

Don’t ask, don’t shell

Step one, of course, is to figure out whether it is legal. While there are many websites (such as Backyard Chickens and Homegrown Evolution) that list laws around the country, I have found them occasionally to be inaccurate, so I recommend you check your city’s municipal code for yourself. Your city’s code should be available online, either from a link on the city’s website or, if not, by searching on Google for “[your city name] and municipal code.” Once you’ve found the code, there are two different places to check.

First, see if there’s a section called “Animals” or something similar. Often cities choose to outlaw certain animals completely, such as ones that are nuisances (loud peacocks) or dangerous animals (venomous snakes), and those would be listed in this section. If you check here and find that chickens or roosters are not specifically outlawed, that’s good — but you have to keep reading.

Next, check the Zoning section. Typically, each zone will specify which animals are allowed in that zone. It’s this section that will likely tell you whether you can have chickens and, if so, how many. (If you’re having trouble navigating the legalese in your code, but the site offers a search function, search on terms like “chickens,” “poultry,” and “fowl.”)

If chickens aren’t legal in your city, ask around. You might find they’re tolerated by the city, so long as your neighbors don’t complain. If this is the case, check with your neighbors — promise them some eggs! — and just get a small flock (four to six) of illegal chickens.