CI focuses on automating code integration and testing, ensuring that code changes can be safely merged into a shared repository. CD extends CI by automating the deployment of code changes to staging or production environments (Continuous Delivery) or directly to production (Continuous Deployment).