Skip to content
UniKit

Movie caption layout

Wraps captions by visual width (full-width characters count 2, half-width 1), splits them into caption cards by a line limit, and reports card count, widest line and card height with a dark caption-bar preview.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Captions (blank line separates; otherwise one per line)
28 px

Caption cards

Wraps by visual width (full-width = 2, half-width = 1) and splits into cards by the line limit. No image is read and no PNG is produced.

Enter captions to see the cards

What this tool does

  • Lay out lines before making a screenshot caption: paste the text, wrap it at a width of 36 and see how many lines and cards each caption becomes.
  • Check mixed Chinese and English widths: Chinese counts 2 and English 1, which prevents the "18 Chinese characters vs 36 letters per line" mismatch.
  • Split a batch: paste one line per caption and let the 2-line limit turn it into cards you can copy as a block.

Example

Input

人生若只如初见
何事秋风悲画扇

Output

#1:1 行,最宽 14 / 上限 36
人生若只如初见

#2:1 行,最宽 14 / 上限 36
何事秋风悲画扇

Without blank lines each line is a caption. Defaults are a width limit of 36, at most 2 lines per caption, 28 px font and 1.4 line height, so each line becomes its own card.

Frequently asked questions

How is the width measured, and why do Chinese lines look shorter?

By visual width: CJK characters and full-width punctuation count 2, while Latin letters, digits and half-width punctuation count 1. At a limit of 36 that is roughly 18 Chinese characters or 36 Latin characters per line — nearly the same on screen, which is what subtitle layout wants.

How does the wrapping work?

The text is first split into whole tokens: a run of Latin letters or digits is one word, and each CJK character is its own token. Tokens are then packed greedily; a word that does not fit moves to the next line whole (hello is never broken into hel + lo). Only a single word longer than the limit is hard-split, and that card is flagged as overflow.

How are paragraphs and cards derived?

With blank lines, each block is one caption and line breaks inside a block are merged into it — the soft-wrap convention of subtitle tools. Without blank lines, every line is a caption. After wrapping, cards hold at most your line limit: three wrapped lines with a limit of two become 2 cards (two lines plus one line).

Does it upload an image or render a caption picture?

No, and it produces no PNG. It only computes the layout and draws a dark caption-bar preview with DOM elements for you to screenshot or copy. It never reads image files, never touches Canvas and makes no network request.

How is the card height estimated?

Height = 2 × 16 px padding + lines × font size × line-height multiplier, rounded to an integer. The default two lines at 28 px and 1.4 gives 32 + round(78.4) = 110 px. Real rendering also depends on the font, letter spacing and browser, so treat it as an estimate.

Keywords:movie captionsubtitle line wrapping

Related tools