Carbohydrates and lipids contain the elements carbon (C), hydrogen (H), and oxygen (O). Proteins contain the elements carbon (C), hydrogen (H), oxygen (O), nitrogen (N), and sulfur (S). Nucleic acids contain the elements carbon (C), hydrogen (H), oxygen (O), nitrogen (N), and phosphorus (P).