One questions that must be answered when ever using an LED is which contact/leg is the Anode or Cathode.
Through Hole
When looking at a through hole LED this often built into the physical characteristics of the LED. Here we have a diagram from Broadcom that shows the Cathode on their part HLMP-EG3G-VX0DD. This is shown in two ways on this part. First when looking at the base of the lens. The flattened side is the cathode side.
On that same part you can also see that the leg on the Cathode side is slightly shorter. While this is not a standard these are both common practice. You should be able to verify this in the data sheet.
Surface Mount
When it comes to surface mount parts it becomes even more important to know your part and look at the data sheets. Almost all surface mount parts will have a marking on them that will indicate the polarity of the LED. Here are some examples of the markings.


You will also find on many of the Data sheets that there is an indication of how the LEDs are loaded into the reel. Here is an example from SunLED.
Should you have any questions about the polarity of your LED please feel free to contact us on here and our team will be happy to assist you.