Pupils in secondary schools with a more diverse racial mix are much more positive about people of different ethnicities, say researchers.
The more mixed the school, the warmer feelings pupils are likely to have towards other races and ethnicities.
The study - from the London School of Economics and the University of Bristol - looked at the attitudes of 4,000 teenagers in English state schools.
Prof Simon Burgess said it showed how schools could change social attitudes.
The study examined young people's attitudes towards people of other ethnicities - such as whether they had friends from other racial groups.
It follows warnings about a lack of social cohesion in some communities and whether different ethnic groups were living parallel lives.
The research found that where schools were more diverse, there was less hostility to other ethnic groups, with the most common groups being identified as white British, Asian British and Black British.
The views of white British pupils were particularly likely to shift when they were at school with other ethnicities.
And the study found that the diversity of the school population was more significant for young people's attitudes than the mix of people in the local area.
But there was still a tendency for young people to feel more positively towards people of their own ethnicity, and to have more friendships in that group.
Even if schools were completely integrated, the study suggests there would still be a core of about 20% of people who would have negative views of other groups.
Prof Burgess of the economics department at the University of Bristol said: "Encouragingly for policy makers, our results show that even small moves away from largely mono-ethnic schools towards more mixed ones produce positive changes.
"It is not the case that anything short of full integration is pointless."
He suggested that the everyday experience of school life - and working alongside each other - helped to remove barriers between young people.
Geoff Barton, leader of the ASCL head teachers' union, said: "When young people from different backgrounds mix, they find they have far more in common than any perceived differences between them."