File types · Explainer

The Ogg file (.ogg, .oga)

An Ogg file is an open, royalty-free container, most often holding sound compressed with Vorbis or Opus. This guide explains what's inside one, how its pages and codecs fit together, the quirks worth knowing, and has free sample Ogg files to download for testing.

At a glance

Full name
Ogg (not an abbreviation); the audio is usually Ogg Vorbis
Extensions
.ogg (traditionally Vorbis), .oga (any Ogg audio); also .opus, .ogv (video), .ogx, .spx (Speex)
MIME type
audio/ogg; video/ogg and application/ogg for video and mixed content
Kind
Binary container, streamable. The codec inside decides lossy (Vorbis, Opus) or lossless (FLAC)
Standard
RFC 3533 (the container, 2003) and RFC 5334 (media types, 2008); maintained by the Xiph.Org Foundation
First released
Ogg grew out of Xiph.Org's work in the 1990s; Vorbis 1.0 was released in July 2002
Common codecs
Vorbis, Opus and FLAC for audio; Theora for video
Opens with
Chrome, Edge and Firefox; Safari from version 18.4 (Vorbis and Opus); VLC, foobar2000, Audacity, Android
Page size
Up to 65,307 bytes; usually about 4 to 8 KB
Magic number
4F 67 67 53 (OggS) at byte 0, and at the start of every page
Patents and licence
Designed to be free of patent royalties; reference libraries under BSD-style licences

The basics

What is an Ogg file?

Ogg is a container format from the Xiph.Org Foundation, the non-profit behind several open audio and video codecs. It was designed to carry media that anyone can use without paying patent royalties. When someone says "an OGG file", they almost always mean Ogg Vorbis: music or sound effects compressed with the Vorbis codec, in an Ogg container, with the .ogg extension. Games, open-source software, many of Wikipedia's sound files and internet radio streams use it.

Like MP4, Ogg is a container, so the extension doesn't say how the sound is compressed. The same .ogg or .oga file could hold:

  • Vorbis, a lossy codec released in 2002 that competed with MP3 and AAC. The classic content of a .ogg file.
  • Opus, a newer lossy codec (RFC 6716, 2012), generally better than Vorbis, especially at low bit rates and for speech. Ogg Opus files should use .opus, but you'll find Opus in .ogg files too.
  • FLAC, lossless audio, which can live in Ogg as well as in its own .flac files.
  • Theora video, in .ogv files. Rarely used today; WebM replaced it on the web.

Anatomy

What's inside an Ogg file

An Ogg file is a sequence of pages, each starting with OggS and a 27-byte header, followed by a table of segment lengths and the data. The codec's packets are cut into those pages. Here is the page layout of sample-vorbis.ogg, our 10-second Ogg Vorbis sample, with the real bytes of the first page. Multi-byte numbers are little-endian.

sample-vorbis.ogg (pages)
offset    size     page                          contents
0         58       page 0   BOS    granule 0     Vorbis identification header
          4F 67 67 53 00 02 00 00 00 00 00 00 00 00 B8 61 04 A0
          00 00 00 00 F7 F5 00 11 01 1E
          01 76 6F 72 62 69 73 00 00 00 00 02 44 AC 00 00
          00 00 00 00 00 F4 01 00 00 00 00 00 B8 01
58        4,123    page 1          granule -1    comment header, part 1
4,181     4,123    page 2   cont   granule -1    comment header, part 2
8,304     5,219    page 3   cont   granule 0     comment header, end
13,523    4,184    page 4          granule 0     setup header (codebooks)
17,707    4,951    page 5          granule 44,608    first audio packets
22,658    8,778    page 6          granule 88,896
31,436    4,715    page 7          granule 133,952
…         …        pages 8 to 13, about 1 second each
75,830    7,872    page 14  EOS    granule 441,000   last audio packets
83,702                                           end of file
  1. 14F 67 67 53 00

    The capture pattern

    OggS, then the format version, always 0. Every page starts this way, so a reader that lands in the middle of a stream (or a damaged file) can scan forward to the next OggS and pick up again.

  2. 202

    The header type flags

    02 marks the first page of a stream (BOS, beginning of stream), 04 the last (EOS) and 01 a page that continues a packet from the previous page. Pages 2 and 3 of this file carry the 01 flag.

  3. 300 00 00 00 00 00 00 00

    The granule position

    A 64-bit position whose meaning the codec defines. For Vorbis it's the number of samples per channel decoded by the end of the page, so the last page's value, 441,000, divided by 44,100 Hz gives exactly 10.000 seconds. -1 means no packet ends on that page.

  4. 4B8 61 04 A0 · 00 00 00 00

    Serial number and page number

    The serial number identifies the logical stream: a file with audio and video, or several chained songs, has one per stream. The page sequence number counts up from 0, so a missing page is easy to spot.

  5. 5F7 F5 00 11 · 01 1E

    Checksum and segment table

    A CRC-32 of the whole page, then the number of segments (1) and their lengths (1E, 30 bytes). Segments of 255 bytes mean a packet continues, which is how one packet can span several pages.

  6. 601 76 6F 72 62 69 73

    The Vorbis identification header

    Packet type 1 and vorbis, alone on the first page as the specification requires. It gives version 0, 2 channels, 44,100 Hz (44 AC 00 00) and a nominal bit rate of 128,000 (00 F4 01 00). The real average here is about 68 kbps: the nominal figure is a hint, not a measurement.

  7. 7pages 1 to 3

    The comment header

    Packet type 3: the tags, in the Vorbis comment format. It includes a 300×300 cover image, so this one packet spreads across three pages.

  8. 8page 4

    The setup header

    Packet type 5: the codebooks and settings the decoder needs. A Vorbis file can't be decoded without it, which is why cutting the start off an Ogg Vorbis file breaks it.

  9. 9pages 5 to 14

    Audio pages

    Each holds about a second of audio packets, between 4 and 9 KB depending on how busy the music is. Page 14 has the EOS flag.

Under the hood

How Ogg works: pages, packets and granule positions

The codec produces packets: a few headers, then compressed audio, each packet a few hundred bytes. Ogg doesn't look inside them. It chops the packet stream into pages of a few kilobytes and puts a header in front of each one. That's the whole design, and it explains Ogg's strengths and its quirks:

  • Built for streaming. There's no index at the start or end. A player can start at the first page, or at any page in the middle by scanning for OggS, and every page has a checksum. Internet radio (Icecast) streams Ogg for exactly this reason.
  • Positions, not timestamps. Each page records a granule position, whose meaning depends on the codec: samples per channel for Vorbis and FLAC, samples at 48 kHz for Opus. The container knows nothing about seconds.
  • Duration takes a second look. To show a file's length, a player reads the granule position of the last page, at the end of the file. Over the web that's an extra range request; if the server doesn't support range requests, players may show no duration.
  • Seeking is a search. Without an index, a player jumps to a guessed byte offset, reads the granule position there, and narrows down (a bisection search). It's quick, but not as instant as M4A's frame table.
  • The end is exact. Because the last granule position gives the exact sample count, the decoder trims the padding in the last packet. Our 10-second Vorbis sample ends at sample 441,000, exactly 10.000 seconds.

One file can also hold several streams. Grouping interleaves the pages of streams that play together, such as video and audio, each with its own serial number. Chaining puts complete streams one after another: internet radio uses it to start a new stream with new tags for each song. A chained file is valid, but some players only read the first stream's tags or stop at the first end-of-stream page.

Codecs

Vorbis vs Opus vs FLAC inside Ogg

CodecFirst packet starts withCompressionNotes
Vorbis01 76 6F 72 62 69 73 (\x01vorbis)LossyGood at about 96 to 192 kbps for music. Three header packets: identification, comments, setup.
OpusOpusHeadLossyGood from very low bit rates for speech up to transparent music. Works at 48 kHz internally, and decoders usually output 48 kHz. Two header packets: OpusHead, OpusTags.
FLAC7F 46 4C 41 43 (\x7FFLAC)LosslessThe same frames as a .flac file, with the STREAMINFO block inside the first packet.
SpeexSpeex Lossy (speech)An older speech codec, in .spx files. Opus replaces it.

Opus has a few habits worth knowing. Its granule positions count at 48 kHz whatever the original sample rate, so our Opus sample, made from 44.1 kHz audio, decodes at 48 kHz. Its header has a pre-skip value, here 312 samples, which the decoder discards at the start; the last page's granule position is 480,312, which is 10 seconds at 48 kHz plus that pre-skip.

Variants

.ogg, .oga, .opus and the other Ogg extensions

RFC 5334 sorted out the extensions in 2008. In practice, software is looser than the RFC, so expect .ogg files with any audio codec inside.

ExtensionMedia typeMeant for
.oggaudio/oggOgg files that contain only Vorbis audio, kept for backward compatibility.
.ogaaudio/oggOgg audio with any codec: FLAC, Vorbis, Speex and others.
.opusaudio/oggOgg files containing only Opus audio (RFC 7845).
.ogvvideo/oggOgg with video, usually Theora.
.spxaudio/oggOgg files containing only Speex.
.ogxapplication/oggAnything else, such as multiplexed content that isn't clearly audio or video.

The media type can name the codec: audio/ogg; codecs=vorbis, audio/ogg; codecs=opus or audio/ogg; codecs=flac. Web pages can ask the browser whether it supports a particular combination with canPlayType().

Metadata

Tags in Ogg files: Vorbis comments

Ogg Vorbis, Ogg Opus and Ogg FLAC all use Vorbis comments: a vendor string naming the encoder, then a list of NAME=value pairs in UTF-8. Names are case-insensitive and free-form, with conventions such as TITLE, ARTIST, ALBUM, TRACKNUMBER, DATE, GENRE and COMMENT. A field can appear more than once, for example two ARTIST entries.

  • Cover art goes in a METADATA_BLOCK_PICTURE field: a FLAC picture block, base64-encoded into text. Our featured sample has one. Older files sometimes use the unofficial COVERART field instead.
  • No ID3. Ogg files don't use ID3 tags. A tool that adds one breaks the file for strict readers, because the file no longer starts with OggS.
  • Editing tags may rewrite the file. Longer tags can push the headers onto more pages, which renumbers every following page and recalculates its checksum. Tag editors handle this, but it means the whole file is rewritten.

Related formats

Ogg vs MP3, M4A, WebM and FLAC

FormatCompressionNotes
.ogg (Vorbis)LossyRoyalty-free, slightly better than MP3 at the same bit rate. Widespread in games and open-source software.
.opusLossyThe best quality per bit of the common lossy codecs, especially below about 96 kbps. Used for voice calls and web audio.
.mp3LossyPlays on everything, including old hardware that has never heard of Ogg.
.m4a (AAC)LossyThe default in Apple's world and most phones. An index makes seeking instant.
.webmLossyA Matroska-based container that also carries Vorbis and Opus, used for web video. Audio-only WebM is common for Opus.
.flacLosslessThe usual home for FLAC audio. Ogg FLAC (.oga) is less widely supported.

Troubleshooting

Common Ogg problems and their causes

  • Won't play on an iPhone, iPad or Mac: Safari only added Ogg Vorbis and Ogg Opus support in Safari 18.4 (macOS 15.4, iOS 18.4) in 2025. On older versions, convert to AAC or MP3, or use VLC.
  • An .ogg file won't play in software that plays other .ogg files: it may contain Opus or FLAC rather than Vorbis. Check with ffprobe and rename Opus files to .opus.
  • No duration shown, or a wrong one: the player couldn't read the last page, often because the server doesn't allow range requests, or the file was cut off before its end-of-stream page.
  • Only the first song's title shows, or playback stops early: the file is a chained recording of an internet radio stream. Split it into separate files, or use a player that handles chained Ogg.
  • Won't open after cutting the start off: Vorbis needs its three header packets. Cut with a tool that understands Ogg, such as ffmpeg -ss 30 -i in.ogg -c copy out.ogg, which keeps the headers.

How to

How to open, edit and convert an Ogg file

  • Play it: Chrome, Edge and Firefox play Ogg Vorbis and Opus, and Safari does from 18.4. Drag the file into a browser or put it online. On the desktop, VLC (all systems) and foobar2000 play every variant; Android plays Ogg Vorbis and Opus natively.
  • Edit the sound: Audacity opens and exports Ogg Vorbis, Opus and FLAC. Each Vorbis or Opus export re-encodes, so export once at the end.
  • Edit tags: Mp3tag, Kid3, foobar2000, MusicBrainz Picard, or vorbiscomment from the vorbis-tools package.
  • Convert: to MP3, ffmpeg -i in.ogg -c:a libmp3lame -q:a 2 out.mp3. From WAV to Ogg Vorbis, ffmpeg -i in.wav -c:a libvorbis -q:a 5 out.ogg; to Opus, ffmpeg -i in.wav -c:a libopus -b:a 96k out.opus.

Is an Ogg file safe?

It can't run code. As with any media format, a deliberately malformed file could trigger a bug in a decoder, so keep players and browsers updated.

Free downloads

Sample Ogg files to download

Free sample Ogg files for testing players, browsers, tag readers and audio pipelines: Vorbis, Opus and FLAC inside Ogg. The sounds are generated chords, encoded with libvorbis, libopus (through FFmpeg) and the reference flac encoder. Each file was checked with ffprobe and decoded in full without errors.

sample-vorbis.ogg · 81.7 KBDownloadOpen

What's inside sample-vorbis.ogg

A 10-second Ogg Vorbis file at quality 4, 44.1 kHz stereo, with tags and cover art: the file shown page by page in the anatomy above.

  1. The music

    Five two-second chords (C, A minor, F, G, C), the same as our MP3 and M4A samples. Bass notes lean left and upper notes right.

  2. Page 0

    The identification header alone on a page with the BOS flag: Vorbis version 0, 2 channels, 44,100 Hz, block sizes 256 and 2,048.

  3. Pages 1 to 3

    The comment header: title, artist, album, date, genre, track number, a comment naming this page, and a PNG cover in METADATA_BLOCK_PICTURE. It's too big for one page, so it continues across three.

  4. Page 4

    The setup header with the codebooks, ending the headers. Audio always starts on a fresh page.

  5. Audio pages

    Ten pages of about a second each. The bit rate averages about 68 kbps, although the header announces a nominal 128 kbps.

  6. The last page

    EOS flag set, granule position 441,000: exactly 10.000 seconds, so players trim the encoder's padding.

All sample Ogg files

  • Ogg Vorbis with tags and cover art

    sample-vorbis.ogg · 81.7 KB (83,702 bytes)

    10 seconds, Vorbis quality 4, 44.1 kHz stereo, with Vorbis comments and a PNG cover in METADATA_BLOCK_PICTURE.

    • Checking a browser, player or upload form handles Ogg Vorbis
    • Testing tag and cover art readers
  • Opus in a .ogg file

    sample-opus.ogg · 132.8 KB (136,003 bytes)

    The same 10 seconds as Opus at a 96 kbps target, 48 kHz stereo, pre-skip 312. Deliberately named .ogg rather than .opus, as many real files are.

    • Catching software that assumes .ogg means Vorbis
    • Testing Opus support and 48 kHz output
  • Lossless FLAC in Ogg (.oga)

    sample-flac.oga · 123.9 KB (126,915 bytes)

    The 4 seconds of CD-quality chords from our WAV and FLAC samples, as Ogg FLAC with the .oga extension. Decodes to exactly the same samples.

    • Testing .oga and Ogg FLAC support, which varies between players and browsers
    • Lossless round-trip tests
  • 1 MB Ogg Vorbis file

    sample-1mb.ogg · 1 MB (1,048,576 bytes)

    60 seconds of the chords on a loop, Vorbis quality 8, with a PADDING comment that makes the file exactly 1,048,576 bytes (1 MiB).

    • Upload and size-limit tests
    • Streaming, buffering and duration display

Ways to test with them

  • Codec support: play all three codecs in the browser you care about. Safari before 18.4 plays none of them; Ogg FLAC support varies elsewhere too.
  • Content sniffing: sample-opus.ogg is Opus behind a .ogg name. A pipeline that picks the decoder from the extension will try Vorbis and fail.
  • Duration: the files should report 10.0, 10.0, 4.0 and 60.0 seconds. A missing duration over the web points to the server not supporting range requests.
  • Lossless round trip: ffmpeg -i sample-flac.oga -f s16le - | md5sum should print afd4c92e93ac8e8a7ccbd0731a2b8b08, the same as our WAV and FLAC samples.
  • Upload limits: sample-1mb.ogg is exactly 1 MiB, so you can test a limit at the boundary.

Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.

Put it online

Have an Ogg file? Give it a link.

Drop an OGG or OGA file on 99helpers and it gets its own address that plays in the browser, with nothing to install. Handy for sharing game audio, sound effects or a recording as a link.

Questions

Ogg files, frequently asked

What is an OGG file?

An audio file in the Ogg container, usually compressed with the Vorbis codec, sometimes with Opus or FLAC. It's an open, royalty-free alternative to MP3 and AAC.

What does OGG stand for?

Nothing: Ogg isn't an abbreviation, which is why its makers write it as "Ogg" rather than "OGG". The capital letters only come from the file extension.

Is OGG better than MP3?

Ogg Vorbis usually sounds a little better than MP3 at the same bit rate, and Opus in Ogg considerably better at low bit rates. MP3 still plays on more devices.

Is OGG lossless?

Usually not: Vorbis and Opus are lossy. An Ogg file can hold lossless FLAC, though, normally with the .oga extension.

What's the difference between .ogg and .oga?

Both are Ogg audio. .ogg traditionally means Vorbis; .oga is the general extension for Ogg audio with any codec, such as FLAC. Many programs use .ogg for everything.

Can an iPhone play OGG files?

Safari plays Ogg Vorbis and Ogg Opus from iOS 18.4. On older versions, use an app such as VLC, or convert the file to AAC or MP3.

What's the difference between OGG and Opus?

Ogg is the container; Opus is a codec. A .opus file is Opus audio in an Ogg container. A .ogg file usually holds Vorbis, an older codec, but can hold Opus too.

How do I convert OGG to MP3?

Use Audacity, a converter app, or FFmpeg: ffmpeg -i in.ogg -c:a libmp3lame -q:a 2 out.mp3. It's a lossy-to-lossy conversion, so use a good bit rate.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.