The modern black rat was probably spread across Europe in the wake of the Roman Conquest and arose from an ancestor that originated in southeast Asia, possibly Malaysia. The Mediterranean black rats differ genetically from their southeast Asian ancestors by having 38 instead of 42 chromosomes. Black rats are considered omnivores and eat a wide range of foods, including seeds, fruit, stems, leaves, fungi, and a variety of invertebrates and vertebrates. They are generalists, and thus not very specific in their food preferences, which is indicated by their tendency to feed on any meal provided for cows, swine, chickens, cats, and dogs. They are similar to the tree squirrel in their preference of fruits and nuts. They eat about 15 grams per day and drink about 15 millilitres per day.
Black rats adapt to a wide range of habitats. In urban areas they are found around warehouses, residential buildings, and other human settlements. They are also found in agricultural areas, such as in barns and crop fields. In urban areas they prefer to live in dry upper levels of buildings, so they are commonly found in wall cavities and false ceilings. In the wild, black rats live in cliffs, rocks, the ground, and trees. They are great climbers and prefer to live in trees, such as pines and palm trees. Their nests are typically spherical and made of shredded material, including sticks, leaves, other vegetation, and cloth. In the absence of trees, they can burrow into the ground. Black rats are also found around fences, ponds, riverbanks, streams, and reservoirs.
The black rat, along with the brown rat, is one of the most widespread rats and animal species in the world.