Pigs are social animals that under free-ranging conditions live in groups of approximately eight individuals. The groups typically consist of three sows and their offspring. Boars are solitary. A hierarchy is formed at social maturity. Sows in the same group cycle at the same time and participate equally in group maternal behavior; one sow will remain with the piglets while the others forage. Communal nesting is also found under free-ranging conditions. In confined pigs, a hierarchy is formed as early as 1 wk of age. Piglets will fight newly introduced piglets in the pen. Piglets also form a teat rank by the end of the first week of life; the dominant piglet suckles on the first pair of teats and gains weight faster. Once the teat order is formed, the hierarchy remains stable as long as the same piglets remain in the same group. Normally, the heavier pig is more dominant. It appears that both genetics and experience play a role; dominant sows give birth to dominant piglets. Once a hierarchy is formed, fighting is mostly replaced with threats. Weaning takes place within the first 3–4 mo of the piglet's life, but in mass production environments, it can take place as early as 3–4 wk of age.

Sows normally have two estrous cycles per year and farrow twice. Pheromones and the sight of a boar are major factors in inducing cycles in gilts. In postfarrowing sows, weaning helps induce estrus; boars can be used to detect females in heat. The boar is usually highly vocal (courting song) and exhibits flehmen when an estrous female is present. Boars will nuzzle the head, shoulders, flank, and anogenital area of sows during courtship. Normally, boars urinate several times and produce thick saliva rich in pheromones. Boars raised without the presence of other pigs show low sexual performance.

Communication in pigs is mainly vocal; there are ~20 different recognized sounds. The grunt is one of the most common sounds, given in response to familiar sounds or while looking for food (rooting). A short grunt is given when the pig is excited, whereas a long grunt is a contact call and normally associated with pleasurable stimuli. When pigs are aroused they may squeal, and they may scream when hurt. Dominant pigs bark at subordinate pigs as a threat. Visual signals in pigs are not well developed. The tail position indicates the well-being of the pig. A tightly curled tail is an indication of a healthy pig, and a twitching tail indicates skin irritation. In mass production environments, tails are normally clipped to avoid tail biting (see Tail Biting). Olfactory signals are highly developed in pigs. There are sex differences; sows can detect lower concentrations of smell and pheromones than boars. When introducing a new pig into an existing group, the resident pigs investigate the newcomer by nosing it. Pigs can form social ranks when they are blindfolded, which indicates the importance of olfactory and vocal communication.

Socialization in piglets starts at ~5 wk of age with conspecifics and at 14 wk of age with other species. Pigs 14–17 wk old are most sensitive, and any negative or unpleasant experience during this period can delay sexual maturity, leading to late first farrowing. In free-ranging conditions, grouping promotes foraging, nursing, and protection against predators. Pigs under free-range conditions will also choose one place to defecate. In commercial production, the most noticeable group behavior is in newborn piglets, which huddle when cold.