Formatting
A barcode symbology is a contract about the characters, not a style. Code 128 takes general text, which is why a SKU like HELLO-42 belongs there. EAN-13 and UPC-A are retail formats: digits only, with a check digit. EAN-8 is the short retail form. Code 39 is an older uppercase set. ITF is interleaved pairs of digits. This page lets you pick the symbology. The EAN page and the UPC page are the same encoders with the format already chosen.
EAN-13 needs 12 or 13 digits and a check digit. Give it 12 digits and the check digit is computed and appended. Give it 13 and the last digit has to already be the correct check, or the code is rejected rather than printed wrong. A 12-digit string 400638133393 becomes the bars for 4006381333931. The same 12 digits with a wrong final 9, if you pass 13 characters, does not encode. Content is limited to 256 characters even on Code 128.
SVG is the print file, because the bars stay crisp. PNG is there when a tool wants pixels. Leave a quiet margin around the bars. This page draws that margin. Do not crop it off in the layout.
Symbology CODE128, content hello, SVG.
An SVG of a Code 128 barcode for the text hello. The same screen set to EAN-13 would refuse hello, because EAN-13 needs 12 or 13 digits and a valid check digit.
Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.
12 or 13. Twelve digits and the page adds the check digit. Thirteen digits and the last one must already be the correct check, or the barcode is rejected.
The characters do not fit the symbology, the check digit is wrong, or the string is longer than 256 characters. Letters belong in Code 128 or Code 39, not in EAN or UPC.
SVG for print, so the bars are not resampled into gray fuzz. PNG if the destination is a raster slot. Either way, keep the quiet zone around the bars.
Sometimes, and you should not count on it. Retail EAN and UPC are what point-of-sale scanners are built for. Test with the device that will scan the label.
It is a computed last digit that catches a mistyped number. If you already know the full EAN-13, include it. If you know the first 12, omit it and let the page append it.