Kelly, who was fired in his third season as coach of the Eagles with one week to go in the regular season, will receive a four-year deal worth $24 million from the 49ers, a league source told ESPN's Adam Schefter.
The Eagles owe Kelly about $13 million over the next two years, but that total will be offset by the deal Kelly signs with San Francisco, a league source told ESPN's Darren Rovell.
Kelly was 26-21 in three seasons with the Eagles after signing a five-year, $32.5 million contract to leave the University of Oregon in 2013.
If those salary numbers hold up and based on an annual breakdown, about $12 million will come from the 49ers and the extra $1 million will come from the Eagles over the next two years.
Kelly, 52, didn't have to wait long to receive a second opportunity as an NFL coach. He was reportedly chosen by the 49ers over Mike Shanahan.
Kelly now receives the chance to help revive a franchise that has won five Super Bowl titles -- the most recent following the 1994 season.
"As one of the most historic franchises in the National Football League, I realize the high standards and expectations that this position demands and I embrace the challenges ahead," Kelly said Thursday in a statement. "My immediate focus is to build the best coaching staff possible, one that will maximize the abilities of each of our players and put us in the best position to win football games."