This questions always stumps me for a couple of seconds every time I come across it so in the interest of saving a couple of minutes of thinking over the duration of my web development career:
If you have a sentence that ends with a hyperlink, like so:
If you want to get in contact, find our contact details here.
Should I end the sentence with the full stop inside the anchor or outside of it?
Reformulate the sentence, e.g. so that only “contact details” are link text. In fact, do you need anything else but “contact details” as a link?
In any case, leave the punctuation outside the link, as it is not logically part of the link text. A terminating period would look odd e.g. in a list of all links on the page (which some browsers are able to generate).
Punctuation as such does not matter much, but link text adequacy does: is the link text understandable even when taken out of context? Link texts are relevant to search engines, too, and should have informative, compact content.
Typographically, it may look slightly weird if a period at the end of a sentence is of different color than the preceding text and lacks underline though the preceding text is underlined. But this is a small price to pay