The 18-year-old English actress voiced her support for the 43-year-old actor in an interview with the Evening Standard. Williams said Elba would be "incredible" as the next Doctor if Peter Capaldi steps down from the role.
"I think a black doctor would be incredible," she said at the London Evening Standard Film Awards, where Elba won Best Actor for Beasts of No Nation. "I'm all for Idris Elba -- but if not, I'll take it for the team and do it!"
Williams, who guest starred on four episodes of the BBC sci-fi series in late 2015, also said "a female doctor would be incredible." The actress would be interested in the role herself, but said she's "locked into some other things" at the moment.
Capaldi debuted as the Twelfth Doctor in Season 8, and is considering leaving the series. Jenna Coleman, who played Clara Oswald, left after Season 9, and showrunner Steven Moffat will depart after Season 10 airs in 2017.
"I didn't realize when I was younger that women were written so badly," Williams told Radio Times last fall. The actress said it was a "joy" to work on Doctor Who after coming across "a lot of really bad characters" for women in her career.
Williams is best known for playing Arya Stark on HBO series Game of Thrones, which will return for a sixth season April 24. The actress hinted at Jon Snow's (Kit Harington) fate in January, telling the Upcoming, "It's a great twist but I can't say he's going to be alive."