The chemical reactions and pathways resulting in the formation of carnitine (hydroxy-trimethyl aminobutyric acid), a compound that participates in the transfer of acyl groups across the inner mitochondrial membrane.
carnitine formation