The New South Wales Parliament has passed legislation allowing same sex couples to adopt.

The bill divided MPs who were given a conscience vote and it was pushed back and forth between both houses as each sought to make amendments.

Under the final provisions, faith-based adoption agencies will be exempt from anti-discrimination considerations.

Also, people giving up children for adoption will have greater certainty that their preferences regarding prospective parents will be met.

Labor frontbencher Frank Sartor says a compromise was reached that finally everyone could support.

"I think we ended up with better law as a result of the arguments that we had," he said.

"But it did take two weeks of debate and wrangling."

Sydney's Lord Mayor and Independent MP Clover Moore says the change has been a long time coming.

"This reform was recommended by the Law Reform Commission in 1997," she said.

"I moved this reform in the house in 2000 but it's taken all this time, but finally we got the vote yesterday."

Minister for Family and Community Services Linda Burney harbours no doubt that the changes will benefit children waiting for adoption.

Ms Burney says it will help many children who would have stayed with gay foster parents until they were 18-years-old.

"They want to be adopted they certainly understand that it's going to be much more stability for them," she said.

"It seems to me that the most vulnerable children in hours state need the same legal status and the same recognition as other children and that's what this bill will achieve."