The Wales international has struggled for game time at the Bluebirds in recent times.
He was allowed to take in a loan spell at Israeli side Maccabi Tel Aviv towards the end of 2013, but returned to Cardiff in the New Year.
Earnshaw has now seen a second spell with the Championship leaders come to an end.
He began his career with Cardiff and returned to South Wales in July 2011 after Nottingham Forest allowed his contract to run down.
Now 31 years of age, he will be continuing his career in Canada.
Earnshaw posted on his Twitter account: "Breaking news: I have now signed and officially a @Torontofc player. Season starts this Saturday. Now on the plane flying to Vancouver for the opening game.
"I want to thank my home town club Cardiff City, I had the best fun playing in front of those Fans from the age of 16 until now.
"I leave with a heavy heart from Cardiff city. I hope we created memories and I tried to give everything I had when I played. I will remember the journey that we went through."