This scientific opinion focuses on the welfare of pigs on farm, and is based on literature and expert opinion. All pig categories were assessed: gilts and dry sows, farrowing and lactating sows, suckling piglets, weaners, rearing pigs and boars. The most relevant husbandry systems used in Europe are described. For each system, highly relevant welfare consequences were identified, as well as related animal-based measures (ABMs), and hazards leading to the welfare consequences. Moreover, measures to prevent or correct the hazards and/or mitigate the welfare consequences are recommended. Recommendations are also provided on quantitative or qualitative criteria to answer specific questions on the welfare of pigs related to tail biting and related to the European Citizen's Initiative 'End the Cage Age'. For example, the AHAW Panel recommends how to mitigate group stress when dry sows and gilts are grouped immediately after weaning or in early pregnancy. Results of a comparative qualitative assessment suggested that long-stemmed or long-cut straw, hay or haylage is the most suitable material for nest-building. A period of time will be needed for staff and animals to adapt to housing lactating sows and their piglets in farrowing pens (as opposed to crates) before achieving stable welfare outcomes. The panel recommends a minimum available space to the lactating sow to ensure piglet welfare (measured by live-born piglet mortality). Among the main risk factors for tail biting are space allowance, types of flooring, air quality, health status and diet composition, while weaning age was not associated directly with tail biting in later life. The relationship between the availability of space and growth rate, lying behaviour and tail biting in rearing pigs is quantified and presented. Finally, the panel suggests a set of ABMs to use at slaughter for monitoring on-farm welfare of cull sows and rearing pigs.