When an object in space moves toward us it's light waves are compressed into higher frequencies or shorter wavelengths, and we say that the light is blueshifted. When an object moves away from us, it's light waves are stretched into lower frequencies or longer wavelengths, and we say that the light is redshifted. The light from most objects in the Universe is redshifted as seen from the Earth. Only a few objects, mainly local objects like planets and some nearby stars, are blueshifted. This is because our Universe is expanding. The redshift of an object can be measured by examining the absorption or emission lines in its spectrum. These sets of lines are unique for each atomic element and always have the same spacing. When an object in space moves toward or away from us, the absorption or emission lines will be found at different wavelengths than where they would be if the object was not moving (relative to us). The change in wavelength of these lines is used to calculate the objects redshift. Redshift is defined as the change in the wavelength of the light divided by the wavelength that the light would have if its source was not moving (called the rest wavelength).
Redshift = (Observed wavelength - Rest wavelength)/(Rest wavelength)