New rules to ensure greater fairness in how schools in England select their pupils have been published by the Department for Education and Skills.
The new code aims to make admissions fairer
The new admissions code, which applies to primary and secondary schools, bans them from assessing parents' work, financial, marital or social status.
It gives schools the option to select by lottery if they want to take pupils who cannot afford to live nearby.
The code comes into force next month, for admissions in September 2008.
Schools must now "act in accordance with" the code rather than merely having to "have regard to" the guidance.
The new regulations also prohibit schools from giving priority to children on the basis of their interests, knowledge or hobbies.
And there must be no priority for the children of parents who are able to support the school financially.
The rules also stop a school giving priority to pupils whose parents put it as their first choice.
The code permits popular schools to use random allocation - or drawing names out of a hat.
"Random allocation can widen access to schools for those unable to afford to buy houses near to favoured schools and create greater social equity," the code says.
Schools must tackle covert selection on the basis of expensive school uniforms, by ensuring the uniform is widely available.
The new code allows priority to be given to the brothers and sisters of older children already at the school - including those that select up to 10% of their intake on the basis of ability.
However these schools - 36 in total - must ensure that local children will not lose out as a result of them offering a sibling priority.
And it says parents should know the outcome of selection tests such as the 11-plus before they make their school choices - a complete reversal of the previous policy.
There is also a requirement for schools and local authorities to have arrangements for children who need a school place outside the usual admissions round, such as the children of service personnel.
The Education Secretary, Alan Johnson, said: "The code creates a system where all children, regardless of their background, have a fair opportunity of gaining a place at the school they want to attend.
"We want to put families at the centre of the decision making process around their children's future."
But the Association of School and College Leaders accused the government of creating an "unnecessarily bureaucratic" admissions system.
"The code itself runs to 112 pages, most of which say "must" and "must not" in bright red several times to schools and local authorities.
"And the documentation on the appeals process is yet to be added," said deputy general secretary Martin Ward.
"This is a clear case of government over-regulation of schools.
"Parents are also likely to find the code confusing and frustrating," he added.
The NASUWT teachers' union welcomed the new code, saying it should "secure more clarity, fairness and equity".
General secretary Chris Keates said: "The outlawing of the process of interviewing parents and pupils, an invidious form of selection which was creeping into some schools, is particularly important.
"However, the new code does not address the practice of permitting some schools to select up to 10% of their intake on the basis of the vague criterion of 'aptitude'.
"NASUWT would have preferred to see this provision scrapped entirely."