Carbon dioxide (CO2) is a covalent compound because it is composed of carbon and oxygen. Herein both the elements i.e. C and O are non-metals.
These elements share the electrons. When electrons are shared, each atom will contain 8 electrons in the outer shell. Due to this, all the atoms of the CO2 will become stable and they will have a completed outer shell.
The lewis structure of CO2 is shown below: