The chemical composition of table salt is NaCl. Table salt is a combination of sodium and chlorine, which form ionic bonds.
Table salt is made up of ions. Ions are formed by atoms gaining or losing electrons, which causes the atoms to be positively or negatively charged. In the case of table salt, sodium loses one electron, while chlorine gains one electron. Therefore, the sodium atoms become positively charged, while the chlorine atoms become negatively charged. In atoms, opposites attract, so these two ions bond with one another in equal parts, forming table salt. Other types of salts do exist, such as magnesium sulfate and calcium acetate.