Dairy farms vary a great deal in the feeding and management systems that are used. These differences affect the performance of the cows, and some genotypes may be affected more than others. If effects of such genotype-by-environment interactions (GxE) are large, then farmers must be made aware of them to make informed breeding decisions. To investigate GxE, a classification system for farm environments was developed based on national- and fine-level data from dairy herds across the United Kingdom. The national data included herd and yield characteristics and local weather information. The fine-level data included information on feeding and management systems on farms, and was obtained from survey results from 778 farms. A principal components analysis of the surveys identified 2 major dimensions characterizing the data. The first dimension explained 14.6% of the variation and was related to the level of production intensity. The second dimension explained 11.5% of the variation and was related to climate. Information on milk yield, herd characteristics, and climate was then extracted from national databases for the survey farms. A canonical correlation analysis was used to relate the survey data to the variables extracted from the national data set to determine the most relevant variables. The canonical correlation between the chosen sets of national data and survey variables was 0.62. This environmental classification was then used to determine how the farm environment affects the life span of dairy cows. The life span of the daughters of 1,000 sires was related to the type of farm environment. The daughters of a majority of sires showed a "plastic" response, with increased life span in less intensive farms. The daughters of a smaller number of sires showed a more generalized response, with life span being less affected by the environment. This GxE suggested that sires vary in the sensitivity of their daughters to different farm environments. This variation in response could allow breeding companies and farmers to match sires to particular farm environments.