That's a spot on explanation by Sadida. To make things even more simple, you should never ever write "it's" in formal writing. So. if you're writing some official correspondence and you find yourself writing "it's", then you should expand it to "it is" (or, sometimes, "it has"). If you can't expand it to one of those, then you want "its" (without the apostrophe).