The 33-year-old made 60 appearances for the Toffees since joining from Swansea in 2016.
He will be reunited with former Swans teammate Joe Allen, who convinced him of the move to bet365 Stadium.
"Joe is one of my best friends, we speak most days and the fact that he's a Stoke player was one of the reasons why I wanted to come here," Williams told the club's website.
"We've spoken a lot over the last couple of days and he's told me all about the club and how it works and what I can expect.
"Joe's decision to sign a new contract earlier this summer was obviously a big thing for the club and it showed how serious Stoke are about getting back into the Premier League.
"To keep a player like Joe Allen, who in my opinion is one of the best midfielders in the country, is a sign that the club is looking to go back in the right direction and that was a big factor in me joining Stoke."