The 19-year-old came close to joining Jurgen Klopp's side in the January transfer window but the deal fell through on deadline day.
Carvalho helped Fulham gain promotion to the Premier League this season, scoring 10 goals and providing eight assists in 36 appearances.
Liverpool will pay an initial compensation fee of £5m to Fulham for Carvalho, whose contract at Craven Cottage would have expired this summer.
Carvalho will sign a five-year contract at Anfield.
"Fabio is a great talent and we did everything we could trying to secure him here on a longer deal so he could play in the Premier League with Fulham," said Fulham owner Tony Khan.
"That didn't prove possible, but we were able to keep him for the remainder of the Championship-winning campaign and for that I know he will always be very fondly remembered by our fans."
In a message to Fulham supporters posted on the club's official website, Carvalho said: "I just want to say thank you for everything they’ve done for me, on and off the pitch.
"On the pitch, they've been singing my name and cheering me on, and off the pitch they're always greeting me.
"Even my family have fans going up to them, saying hello, which makes me happy.
"There's obviously been ups and downs this season, but I’ve had some great messages from great fans.
"I just want to say a big thank you to all the Fulham fans, as without them I wouldn’t be in the position I am today, so thank you so much."