Doctors have an ethical and legal duty to respect patient confidentiality. We consider the basis for this duty, looking particularly at the meaning and value of autonomy in health care. Enabling patients to decide how information about them is disclosed is an important element in autonomy and helps patients engage as active partners in their care. Good quality data is, however, essential for research, education, public health monitoring, and for many other activities essential to provision of health care. We discuss whether it is necessary to choose between individual rights and the wider public interest and conclude that this should only rarely be necessary. The paper makes some recommendations on practical steps which could help ensure that good quality information is available for work which benefits society and the public health, while still enabling patients' autonomy to be respected.