Ethical codes are sets of guidelines that outline the moral principles and professional standards expected from journalists in their practice. They serve to protect the integrity of journalism by promoting accountability, transparency, and respect for the rights of individuals, particularly when balancing privacy concerns against the public's right to know. These codes emphasize the importance of responsible reporting, ensuring that journalists consider the potential impact of their work on both individuals and society as a whole.