Skip to main content
SubtitleMatrix

Balance Subtitle Line Breaks

Text and stylingRewrap lines
Or paste subtitle text

Options

One box, five choices, and each choice has a page of its own. Wrap re-flows every cue to the column count, which can shorten a line that was too long as easily as it can pull a short line back up. Split long lines breaks only the lines that are over the count and leaves the rest exactly as they were. Balance keeps the number of lines each cue already has and moves the words between them until the longest line is as short as it can be. Join puts each cue onto a single line. Limit leaves alone every cue that is already within the line count. This page fills the box in with the choice its title names and lists no other.

Which frame rate the timings are counted in. On the format pages this is what MicroDVD needs, because it stores timing as frame numbers. On the frame rate pages it is the rate the file was timed against — the version the subtitles were made for — and the page's second box takes the rate of the video you are going to use them with. 23.976, 24, 25, 29.97, 30, 50, 59.94 and 60 are the common ones. Getting it wrong shifts the whole timeline, and on the frame rate pages it shifts it by a ratio rather than by a fixed amount.

This page evens out the lines a cue already has. It keeps the number of lines exactly as the file wrote them and moves words between those lines until the longest one is as short as it can be. A cue that arrives on two lines of 63 and 5 columns leaves on two lines of 33 and 35, and the cue beside it that was already even does not move at all.

That is what separates this page from the ones that wrap or split. Wrapping works to a column count you set and is free to add or remove lines; the split page only touches lines that are over the count. Here the number of lines is not an input at all — it is a fact read from the file, taken as something you or your player have already settled — and the only thing that changes is where the words sit inside it.

The rule the page follows is that the longest line should be as short as possible, which is not the same as spreading the words out evenly. Words have different lengths, so dividing the words into equal counts gives one long line and one short one. The page instead asks how narrow the lines could be if the cue still had this many of them, and lays them out to that width. In practice the two lines come out looking the same length, which is the thing you notice on screen.

Some cues are left completely alone, and the page says so by reporting nothing rather than by claiming a successful run. A cue with one line has no second line to move words into. A cue whose every line already holds a single word is as short as that many lines can be. And a line that starts with a dash marks a change of speaker: those blocks are kept apart from each other, because moving half of one person's line into another's is not an even split but a mix-up. All of it runs in your browser, with no upload, across the eleven formats that carry more than one line per cue: SRT, WebVTT, ASS, SSA, SBV, SAMI, LRC, MicroDVD, TTML, JSON and CSV.

Examples

A short second line and a long first one

Input

1
00:00:01,000 --> 00:00:04,000
We could take the train and be there by six
or wait for the later one.

Output

1
00:00:01,000 --> 00:00:04,000
We could take the train and be there
by six or wait for the later one.

The first line was 43 columns and the second 26, so the page moved `by six` down from the first line to the second and stopped there: 36 and 33 columns is the closest this pair can be brought, and pushing further would have made the second line the longer of the two. The cue still has two lines, the number of words is the same in the same order, and the timing and cue number are untouched.

A cue that is already even

Input

1
00:00:01,000 --> 00:00:04,000
The train leaves at six
in the evening Seven.

Output

1
00:00:01,000 --> 00:00:04,000
The train leaves at six
in the evening Seven.

23 and 21 columns, which is the most even this pair of lines can be, so the page has nothing to do and the file comes back byte for byte. Nothing is reported either, because a run that found no work is not a run that did something. This is worth seeing once: a tool that rewrote the lines anyway would have risked changing a file that was already correct, and there would have been nothing in the report to warn you.

A Chinese word against an English line

Input

WEBVTT

00:00:01.000 --> 00:00:04.000
你好
Good morning to you everyone

Output

WEBVTT

00:00:01.000 --> 00:00:04.000
你好 Good morning
to you everyone

The Chinese line is two characters, which is 4 columns, against an English line of 28 — a cue no reader would call balanced, and the page agrees. It pulls `Good morning` up so the lines are 17 and 15 columns. Counting characters instead of columns would have called the Chinese line two units long and moved almost nothing, leaving the imbalance this page exists to fix. The look of the two lines on screen is what is being evened out, not the number of characters in them.

Frequently asked questions

What does balancing subtitle line breaks actually change?

Where the words sit inside a cue, and nothing else. The number of lines stays the same, the number of words and their order stay the same, and the start time, end time and cue number are the file's own. It is the page to use when the line count is already right for your player or your house style and the problem is only that one line is much longer than its neighbour.

Why is balancing not the same as splitting the words evenly?

Because words are not all the same length, so an even count of words per line gives an uneven look. A line holding `I` and a line holding `internationalization` would each have one word, and one of them is 20 columns wide. The page asks how narrow the lines could be while there are still this many of them, and lays the text out to that width, which is why the two lines come out close to the same measure rather than close to the same word count.

Does balancing change the number of lines a subtitle has?

No, and that is the point of the page. The line count is read from the cue and used as a fixed constraint, so a two-line cue returns as a two-line cue and a three-line cue as a three-line cue. If what you want is a different number of lines, the wrapping page works to a column count you give it and can produce more or fewer lines, and the page that caps lines per subtitle works to a maximum instead.

Why were my dash lines left unbalanced?

Because a dash at the start of a line marks a change of speaker, and the two blocks are balanced separately from each other, not against each other. Two lines of 14 and 18 columns stay 14 and 18: moving part of one speaker's words onto the other's line would put two people's dialogue on one line, which is the opposite of what those dashes are there to do. A block that is a single line has nothing to move within it.

What happens to a cue with only one line, or with one word per line?

It comes back unchanged and the run reports nothing for it. One line has no second line to move words into. A cue whose lines each hold a single word is already as short as that number of lines can be, since no word can be divided. In both cases the file is passed through without being rewritten, and the report stays empty rather than counting a cue as having been processed.

Which formats can have their line breaks balanced?

The eleven in which a cue can hold more than one line: SRT, WebVTT, ASS, SSA, SBV, SAMI, LRC, MicroDVD, TTML, JSON and CSV. Plain text is excluded because one line of text is one cue there, so every cue has exactly one line and balancing can never do anything. The eleven are read for what they are rather than for their file extension, and nothing is uploaded while the page runs.

Related tools