Redshift

Most galaxies appear to be moving away from us. This means that the light from them is "stretched" slightly and appears a bit redder that it would otherwise do.

This is similar to what happens to sound. Imagine that a fire engine is driving past you with its siren on. When it is moving towards you, the siren it quite high pitched. When it is moving away from you, the pitch drops and it sounds lower. With light, "lower" means more red and "higher" means more blue.

You can see what this looks like in the diagram below, where two galaxy spectra are compared.

Example of how absorption/emission lines in a spectrum can be redshifted.
Credit: NSO

 

 
 
 
 
 
 
 
 
 
 
 
 
In fact, the further away a galaxy is, the faster it appears to be moving, and hence the more the spectrum is redshifted. Astronomers can, therefore, measure the distance to a galaxy by taking a spectrum and seeing how much the lines that you would expect to see have been shifted.