The directed movement of a cofactor into, out of or within a cell, or between cells, by means of some agent such as a transporter or pore. A cofactor is a substance that is required for the activity of an enzyme or other protein.