SRT to VTT
Published Updated
Convert an SRT subtitle file to WebVTT by adding the WEBVTT header, changing each comma in a timestamp to a period and dropping the cue numbers. Styling tags such as <i> pass through, cues with no blank line between them are still split, and a block whose timestamp cannot be read is counted in a message.
What changes between the formats
SubRip has no formal specification. The Library of Congress format description records little to no formal documentation, and says the format is not well standardized. WebVTT does have one, from the W3C. The page's output, from Google Chrome 156, shows the differences:
| SRT input | WebVTT output |
|---|---|
| Nothing before the first cue | A WEBVTT line and a blank line |
00:00:01,000 --> 00:00:03,500 | 00:00:01.000 --> 00:00:03.500 |
Cue number 1, 2, ... | Removed |
Hello <i>there</i> | Unchanged |
{\an8}Top line | Unchanged, and not valid WebVTT |
| CRLF line ends | LF line ends |
Why browsers want VTT
The HTML track element takes its subtitles in WebVTT, as MDN's track reference states, which is the usual reason to convert an SRT. The W3C text says the timestamp has a period before the three millisecond digits, and that the hours part may be left out when it is zero. Output from this page always keeps two-digit hours.
What the converted file does in each browser's parser
Generated SRT files went through the page's own converter in Node.js 22.23.1, Google Chrome 157, Firefox 155 and Playwright's WebKit build (not the Safari app). The output was the same, character for character, in all four. Each browser then loaded it as a track on a muted audio element and reported the cues its own WebVTT parser found. Measured results:
| SRT input | WebVTT output | Cues each engine's own parser read |
|---|---|---|
| Byte order mark, CRLF line ends, or lone CR line ends | The same file as with plain LF line ends | 2 of 2 |
Hours left out: 01:02,500 --> 01:04,000 | 00:01:02.500 --> 00:01:04.000 | 2 of 2, one starting at 62.5 s |
| A period in the start time and a comma in the end time | Both with periods | 1 of 1 |
0:00:01,000 (one-digit hour), 00:00:1,000 and 00:00:03,5 | Only the first is written, as 00:00:01.000; the message counts 2 blocks left out | 1 of 1 |
| Cue numbers 5, 9 and 2 | No numbers; the cues keep file order | 3 of 3 |
| Two overlapping cues | Both kept | 2 of 2 |
| A cue with no text | Kept, with no text | 2 of 2 |
Text containing A --> B | A --> B | All text shown, as A --> B |
Text containing 5 < 6 and 7 > 3 | 5 < 6 and 7 > 3 | All text shown |
{\an8}, <b> and <font color="#ff0000"> | Copied unchanged | {\an8} shown as text, the bold tag kept, the font tag dropped with its text kept |
| Latin-1 bytes (the letter e with an acute accent as one byte) | The U+FFFD replacement character, and a warning on the page | 1 of 1 |
| UTF-16 little endian with a byte order mark | Decoded and converted | 2 of 2 |
| 5,000 cues, 258,897 characters of output | Converted in 16 ms (Chrome 157), 21 ms (Firefox 155), 13 ms (WebKit build) | 5,000 of 5,000 |
The WebVTT specification says a cue payload must not contain the substring --> and lists an HTML character reference among the cue text components, which is why the page writes the greater-than sign of --> as > and a stray less-than sign as <. Text after a blank line inside one cue is left out, with no count in the message: the blank line ends the cue and the lines after it have no timing line.
Converting a file
Step 1
Add the .srt file
One file at a time. It is read as UTF-8, with a byte order mark accepted, and a warning appears when the bytes are not valid UTF-8.
Step 2
Press Convert to VTT and Download
There is no preview or cue count; the file converts and saves in one step. The result is named after your file with .vtt.
Step 3
Attach it to a video
In HTML, point a track element at the .vtt file. If you host it, label it text/vtt, which is the type the W3C specification names.
What it does not do
- It does not shift or retime anything: every timestamp is copied.
- It does not validate the file: a block whose timestamp cannot be read is left out, and a message gives the count.
- It does not add cue settings such as position or alignment.
- To go back, VTT to SRT renumbers the cues, and Burn Subtitles into Video makes them permanent.
SRT to VTT questions
What if cues have no blank line between them?
They are still separated. The converter starts a new cue at every timestamp line, and a line holding only a number just above a timestamp is read as that cue's number. A cue whose own text ends in a bare number, with no number line after it, can lose that line, so keep a blank line between cues when you can.
Which timestamps are read, and what if some are not?
Hours of one to three digits are read (0:01:02,500 and 100:00:01,000 work), and the output always has at least two hour digits. A block with an --> arrow whose timestamp cannot be read is left out, and a message shows how many were skipped. A file with no readable cue at all is not converted.
Are the cue numbers kept?
No. WebVTT does not need them, so the numbers 1, 2, 3 are dropped, and each cue starts with its timing line.
What happens to italics and top positioning?
Tags are copied untouched. The W3C lists italic and bold spans among the WebVTT cue components, but it has no brace-style positioning tag such as an8, so those braces stay as plain text.
My accented letters are replaced by a different character.
The file was probably saved as Windows-1252, where an accented letter is one byte that UTF-8 cannot read; it comes out as the replacement character U+FFFD, and a warning appears. Re-save it as UTF-8 and convert again. UTF-16 files that start with a byte order mark are read as UTF-16.
Is the file uploaded?
No. The text is read and converted in the page, and the download is built from memory.
What happens to --> or a lone < inside a cue?
The tool writes --> as --> and a < that does not start a tag as <, because a player reads a stray < up to the next > as a tag and a line holding --> ends the cue. In the test, a cue with A --> B and one with 5 < 6 and 7 > 3 showed all their text in the three engines' own parsers.
Does the converted file load in Chrome, Firefox and WebKit?
The output loaded as a track in Chrome 157, Firefox 155 and the WebKit build, and each parser read the same cue count: 2 of 2 for a small file and 5,000 of 5,000 for a 258,897 character file.
Is text after a blank line inside a cue kept?
No. A blank line ends the cue in SRT, so the lines after it have no timing line and are left out, with no count in the message. Put the lines of one cue directly under each other.
Does a UTF-16 subtitle file work?
If it starts with a byte order mark, yes: a UTF-16 little endian file gave the same 2 cues as its UTF-8 copy.