Dual-code international superstar Sonny Bill Williams has announced his retirement from rugby union and rugby league.

He officially departs the NRL after 123 first-grade appearances over eight seasons for the Canterbury Bulldogs and Sydney Roosters.

The 35-year old on Thursday afternoon posted a heartfelt farewell on social media.

"A massive thank you to the public & fans for all the support over the last 17 years," he posted.

"To my many teammates, thanks for the lessons and help along the way. It wasn’t a perfect journey by any means but the lessons have helped shape me into the man I’m proud to be off the field today. #AlwaysAlhamdullilah"

Williams won a premiership with the Bulldogs in his first season in 2004 and played four seasons at Belmore before moving to rugby at the end of 2008.

He returned to the NRL for two seasons with the Roosters in 2013 and 2014 and won a premiership with the Tricolours that season, then shifted back to the 15-man code.

Williams made one final comeback to the NRL last season at the Roosters but played just five games.

The cross-code veteran has also played 12 matches for the Kiwis and made 58 appearances for the All Blacks, including three Rugby World Cup appearances.

He will remain at the Roosters in an off-field role and continue his professional boxing career.