Carbon dioxide, or CO2, forms a covalent bond. Any compound made up of non-metals will form a covalent bond, while compounds made of a metal and non-metal form an ionic bond. A covalent bond takes place when two atoms share electrons, thus binding the two atoms together.
In an ionic bond, one atom donates an electron to another atom, creating ions, which are positively and negatively charged atoms. These ions are attracted to each other, creating a bond. Sodium chloride, or NaCl, is a type of ionic bond where sodium donates an electron to chloride, making sodium a positively charged ion and chloride a negatively charged ion.