Assuming that you are referring to the common Point Of Sale barcode formats these all carry some variant of a product identifier referred to as a Global Trade Identification Number (GTIN):
- UPC-A - GTIN-12
 
- UPC-E - Zero-suppressed GTIN-12 [*]
 
- EAN-13 - GTIN-13
 
- EAN-8 - GTIN-8
 
Each of these except GTIN-8 can be converted into a GTIN-14 by prefixing with "0"s. (GTIN-8 is a discrete number system that is not currently mapped into any part of the GTIN-14 number system.)
After which the "Lookup" part of the following answer applies:
https://stackoverflow.com/a/31760872/2568535
[*] A zero-suppressed GTIN-12 can be converted to twelve-digit format ("UPC-A") as described here: https://stackoverflow.com/a/31539006/2568535