Cobalt sulfide nanoparticles were introduced into the medium-pore zeolite ZSM-5 (Zeolite Scony Mobil Five) by ion exchange in aqueous suspension and also by the addition of cobalt sulfate to the synthesis gel in hydrothermal zeolite synthesis. The latter method was systematically studied in the presence of tetraethylammonium ions as organic agents. The materials were characterized by chemical analysis, x-ray diffraction (XRD), scanning electron microscopy (SEM), Transmission electron microscopy (TEM), energy dispersion x-ray (EDX), IR, BET and diffuse reflectance spectroscopy (DRS). SEM picture and BET were used to discriminate between CoS nanoparticles in the zeolite pores and on the outer crystal surface. Their crystalline structure and morphology were studied by XRD and scanning electron microscopy. The results showed that in hydrothermal method zeolite acts as a template. CoS nanoparticles with an approximate size of 22 nm grow on the surface of zeolite. In ion exchange method, however, the majority of CoS nanoparticles are about 6 nm in diameter, located on the surface of the MFI (type materials ZSM-5) structure. Exciton absorption peaks at higher energy than the fundamental absorption edge of bulk CoS indicate quantum confinement effect in nanoparticles as a consequence of their small size. The absorption spectra show that the optical band gap for CoS nanoparticles produced by hydrothermal and ion exchange methods is 3.68 and 4.1 eV, respectively.