The 21-year-old Italian, at Manchester United since 2007, had been loaned out to Sampdoria and Queen's Park Rangers before returning to Manchester this season where he played mostly in the Under-21 team.
"We wanted to sign a forward and are happy to have brought in Federico Macheda," said Stuttgart sports director Fredi Bobic after the Italian's first training session with Stuttgart.
"He is young, hungry and fits well with the VfB. He comes from a top club where he has shown what he can do. Now we want to integrate him into the team as quickly as possible."
Macheda made a stunning debut for Manchester United in 2009, scoring a brilliant stoppage-time goal after coming on as a substitute to secure a vital 3-2 Premier League win over Aston Villa.
He also struck a late winner 46 seconds after coming on in his next match against Sunderland and United won the title that season, but Macheda's Old Trafford career has stalled since and he has played fewer than 20 Premier League matches for the club.
Stuttgart have lost their last two Bundesliga games, slipping to 10th place on 25 points after a solid first half to the season.
The club extended contracts of five players in the winter break as it looks to establish continuity and a contract extension with coach Bruno Labbadia is also on the cards.