Boxing is a sport; they follow strict rules and guidelines for what they can and cannot do in a fight.
Karate is a martial art, developed to be effective in battle and self defense. It will teach you many moves that boxing will not, including:
kicks
grappling
lethal techniques
weapons
Boxing is better for fitness by a long shot. For self defense it is also great, if you've ever been hit by a boxer bare-knuckled you would know why. Pretty much 1 punch will dispatch an enemy. It is the king of stand up fighting and onl lacks ground game but a good boxer won't get taken down. but for self defense all you really need to know is the 4 basic boxing punches, some Judo throws, a little wrestling, and some dirty fighting like headbutting, elbows, groin kicks and punches, eye gouging, ear slaps, throat punches, kidney punches, etc. A boxer can end a fight with 1 punch, but getting hit in the balls, headbutted or having your eyes gouged out is even worse.