The actor will be talking openly to pupils at Rossett School
Sir Ian McKellen has visited a Harrogate school as part of a campaign to tackle homophobic bullying.
The actor, who is the co-founder of the campaigning organisation Stonewall, spoke to pupils at Harrogate's Rossett School.
The visit was organised through Stonewall's Education Champions Programme which helps schools prevent and tackle homophobic bullying.
The actor spoke about his experiences as a gay man on December 15.
The actor co-founded Stonewall in response to Section 28 of the Local Government Act that legislated against what it considered the promotion of homosexuality within the education system.
Recent YouGov research for Stonewall found that nine in 10 teachers said their pupils currently experienced homophobic bullying, but nine in 10 had never received any training on how to tackle and prevent it.
Sir Ian said: "Until I visited secondary schools recently, I hadn't realised how much anti-gay bullying goes on, throughout the education system."
During his visit, pupils were asked to consider the changing attitudes towards homosexuality.
Sir Ian also spoke about his own decision to be open about his sexuality and the challenges that young people can face in expressing their sexuality.
The actor said:
"By talking frankly about my own life as a gay man and listening to the concerns of staff and students, parents and governors, I hope the visits arranged by Stonewall may make a difference in the classroom and the playground.
"I also hope it will give confidence to gay students about their lives in the future."
The head teacher of Rossett School, Pat Hunter, said her school did not have a particular problem but she added that Sir Ian's visit had been a "positive step".
Sir Ian is also visiting schools in Wigan, Bristol, Cambridge, Newcastle, Leeds and several London boroughs throughout this winter.