SRT has no formal specification. It was defined by what the SubRip program wrote, and what follows is the layout that player and library authors agree on, including the places where they do not.
File layout
A file is a sequence of cues. There is no signature, header, version number or footer, so a program can only recognise SRT by the extension or by the shape of the first cue.
The text encoding is not stated in the file. SubRip wrote Windows-1252 by default and
offered many code pages and Unicode forms, with or without a byte order mark.
Readers must therefore guess, using a byte order mark when there is one. UTF-8 is the
usual form today, and Matroska stores SRT text as UTF-8. There is no registered media
type; application/x-subrip is in common use but not IANA-registered.
One cue
| Line | Name | Content | Notes |
|---|---|---|---|
| 1 | Counter | A decimal number | Starts at 1 and rises by 1. Most players ignore its value, and Matroska drops it when it stores the track. |
| 2 | Timing line | start --> end | The time the text appears and the time it goes, optionally followed by coordinates. |
| 3 onward | Text | One or more lines | The subtitle, with optional formatting. It ends at the first blank line. |
| last | Separator | A blank line | Ends the cue. The final cue may or may not have one. |
Lines end with CR LF or LF. A blank line inside the text ends the cue early, so subtitle text cannot contain one.
Time format
A time is written HH:MM:SS,mmm.
| Part | Digits | Range | Meaning |
|---|---|---|---|
HH | 2 | 00 and up | Hours, zero padded |
MM | 2 | 00–59 | Minutes, zero padded |
SS | 2 | 00–59 | Seconds, zero padded |
, | 1 | A comma, where WebVTT uses a full stop. This is the quickest way to tell the two apart. | |
mmm | 3 | 000–999 | Milliseconds, zero padded |
The two times are separated by a space, --> and a space.
Coordinates
SubRip could record where it found the text on screen. It wrote the box after the end time, in pixels of the source video. This is an unofficial extension, and most players ignore it.
00:02:16,612 --> 00:02:19,376 X1:201 X2:516 Y1:43 Y2:68
| Name | Meaning |
|---|---|
X1 | Left edge of the text box |
X2 | Right edge of the text box |
Y1 | Top edge of the text box |
Y2 | Bottom edge of the text box |
Worked example
1
00:00:01,000 --> 00:00:03,500
Where are we going?
2
00:00:04,000 --> 00:00:06,250
Somewhere
we have never been.
Relatives
WebSRT was a 2010 WHATWG proposal for the HTML <track> element,
based on SRT and also using the .srt extension. It was renamed
WebVTT, which requires a WEBVTT signature
and full stops in times. It is not compatible with SRT.