Quantum confinement occurs when the dimensions of a material are reduced to a size comparable to the de Broglie wavelength of the electrons. This leads to the quantization of energy levels, causing the bandgap to increase as the size of the nanostructure decreases. As a result, nanoparticles and quantum dots exhibit size-dependent optical and electronic properties.