What is the major difference between a file format and an audio codec?

A file format is a file extension or a standard which stores a computer file. Data is always stored with a specific file format.
An Audio codec is the method or a way which performs the operation of encoding and decoding of data.