"@49ers fans, I wanted to be the first to tell you I’m returning to San Francisco," Boldin wrote on his personal twitter account.
A league source confirmed that Boldin's contract is two years for $12 million.
In 2013, Boldin reached the 1,000-yard mark for the first time since 2009, catching 85 passes for 1,179 yards and seven touchdowns. The yardage total made it his fourth most productive season in his NFL career.
The Niners traded a draft pick to Baltimore last offseason, with Boldin entering the final year of his contract.
In his 11-year career with the Cardinals, Ravens and 49ers, Boldin has caught 857 passes for 11,344 yards and 65 touchdowns.
Follow me on Twitter: @RavensInsider
Aaron Wilson covers the Ravens for The Baltimore Sun.