Documentation Index

Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt

Use this file to discover all available pages before exploring further.

Image & Video APIs

Advanced text layer options

Last updated: Jul-15-2026

This page covers auto-line breaks for video text overlays. For custom fonts, Google Fonts, predefined text templates, and Chinese and Japanese font support, see Custom and special fonts. For styling parameters, color, multi-line text, and special characters, see Text layer options. For the layer syntax itself, see Layer syntax.

On this page:

Auto-line breaks

Cloudinary can also automatically wrap your text into multiple lines based on a specified maximum width for the text string. To do this, apply the fit crop mode to the text layer and specify the width to use for word wrapping. This setting tells Cloudinary to automatically wrap the actual text content onto a new line once the width is reached.

Notes
  • Automatic text wrapping is only supported when you specify a numeric pixel width for your text layer together with the fit crop mode, for example w_220,c_fit. Percentage-based widths are not supported for text wrapping.

    Relative widths or using fl_relative will resize the text layer but won't trigger automatic line breaks.

  • c_fit (called textFit in the latest major version of some SDKs) is the only 'resize' option that you can use as a qualifier of text overlays.

For example, to add a long text string in bold Neucha font with a size of 26 pixels to the base video that wraps at a width of 400 pixels:


When using the fit (textFit in some SDKs) crop mode, you must specify a width for your text overlay, but height is optional. Line breaks are applied as needed to achieve the requested width and/or height rectangle.

The specified font size of your overlay stays as is, even if the resulting text overlay height exceeds the height of its hosting video. So, if you don't limit the overlay height, the height of the video expands to accommodate large texts:


If you do limit the height of your overlay, any text that does not fit within the space defined is cut and an ellipsis (...) is added to the end of the text string to indicate that the text was truncated.

To define a maximum height for the multi-line text add the height parameter in addition to width in the 'resize' transformation of your text layer:


You can also set text alignment and line spacing values to further control the text's appearance. Other resize parameters can be applied as an action over the entire overlay (before the fl_layer_apply) to resize the resulting the text-image overlay as a whole after it's created.

For example, to add a long text string in center aligned bold Times font with a size of 14 pixels to the base video, that wraps at a width of 200 pixels and is limited to a height of 150 pixels; and then rotate the text by 9 degrees and set 30 pixels from the north border to better align with the underlying video:

Related topics

✔️ Feedback sent!

Rate this page:

one star two stars three stars four stars five stars