Objectives: To examine whether there are socioeconomic gradients in the incidence, prevalence, treatment, and follow up of patients with heart failure in primary care. Design: Population based study. Setting: 53 general practices (307 741 patients) participating in the Scottish continuous morbidity recording project between 1April 1999 and 31 March 2000. Participants: 2186 adults with heart failure. Main outcome measures: Comorbid diagnoses, frequency of visits to general practitioner, and prescribed drugs. Results: 2186 patients with heart failure were seen (prevalence 7.1 per 1000 population, incidence 2.0 per 1000 population). The age and sex standardised incidence of heart failure increased with greater socioeconomic deprivation, from 1.8 per 1000 population in the most affluent stratum to 2.6 per 1000 population in the most deprived stratum (odds ratio 1.44, P=0.0003). On average, patients were seen 2.4 times yearly, but follow up rates were less frequent with increasing socioeconomic deprivation (from 2.6 yearly in the most affluent subgroup to 2.0 yearly in the most deprived subgroup, P = 0.00009). Overall, 812 (80.6%) patients were prescribed diuretics, 396 (39.3%) angiotensin converting enzyme inhibitors, 216 (21.4%) β blockers, 208 (20.7%) digoxin, and 86 (8.5%) spironolactone. The wide discrepancies in prescribing between different general practices disappeared after adjustment for patient age and sex. Prescribing patterns did not vary by deprivation categories on univariate or multivariate analyses. Conclusions: Compared with affluent patients, socioeconomically deprived patients were 44% more likely to develop heart failure but 23% less likely to see their general practitioner on an ongoing basis. Prescribed treatment did not differ across socioeconomic gradients.