The lifespan of crabs varies depending on the species, but most species live between 1-3 years in the wild. Some species, such as the king crab, can live for up to 20 years in the wild. In captivity, crabs can live longer due to the controlled environment and access to food and care.