The two clubs have announced that the England international has completed a permanent move from Anfield to Upton Park and will wear the No.9 shirt next season for the Hammers
The 24-year-old spent last season on loan with the Hammers, scoring seven times as Sam Allardyce's side finished tenth in the Premier League.
The England international says he is thrilled to make the move and feels there is a bright future ahead in east London.
"It's fantastic for me to be here. I really enjoyed last season, and that shows in me coming back and making it permanent," Carroll told the club's official website.
"The fans, the lads and the club itself has been great to me, and what I wanted to do was come back here and play football.
"Since the end of the season I've had a lot of time to think, I've missed it and that's why I'm back. Getting promoted the season before last, then finishing where we did - we did great, and it can only get better for us.
"The way the club's being run, obviously getting the new stadium and everything like that, it's only going up."
Carroll joined Liverpool from Newcastle in January 2011 for £35 million, scoring 11 times in 58 appearances for the Merseysiders.