What Is Codec?
A codec (coder-decoder) is an algorithm that compresses and decompresses audio or video data, determining the quality, file size, and compatibility of media files.
Codec explained
A codec (portmanteau of coder-decoder) is a software algorithm that encodes (compresses) raw media data into a compact format and decodes (decompresses) it for playback. Codecs are distinct from container formats: the codec handles the actual compression math, while the container (MP4, MKV, WebM) packages the compressed streams together. Popular video codecs include H.264 (the most widely compatible), H.265/HEVC (50% better compression), VP9 (Google's open-source alternative), and AV1 (the newest, most efficient, and royalty-free option). Popular audio codecs include AAC, MP3, Opus, and FLAC. Choosing the right codec involves balancing compression efficiency, quality, encoding speed, hardware support, and licensing — there is no single best codec for every situation.
Key points
Real-world examples
Related terms
A container format is a file wrapper (like MP4, MKV, or AVI) that packages compressed video, audio, subtitles, and metadata streams into a single file.
Lossy compression reduces file size by permanently discarding data deemed less perceptible, trading some quality for significantly smaller files.
Lossless compression reduces file size without discarding any data, allowing the original file to be perfectly reconstructed from the compressed version.
AVIF is a next-generation image format based on the AV1 video codec, offering the best compression efficiency available today while being royalty-free.