Display text in small font.

This should be used for captions, asides, footnotes, sidenotes, and other explanatory text.

Function signature

st.caption(body, unsafe_allow_html=False)


body (str)

The text to display.

unsafe_allow_html (bool)

By default, any HTML tags found in strings will be escaped and therefore treated as pure text. This behavior may be turned off by setting this argument to True.

That said, we strongly advise against it. It is hard to write secure HTML, so by using this argument you may be compromising your users' security. For more information, see:


Also note that `unsafe_allow_html` is a temporary measure and may be removed from Streamlit at any time.

If you decide to turn on HTML anyway, we ask you to please tell us your exact use case here: https://discuss.streamlit.io/t/96 .

This will help us come up with safe APIs that allow you to do what you want.


st.caption('This is a string that explains something above.')

Was this page helpful?

editSuggest edits

Still have questions?

Our forums are full of helpful information and Streamlit experts.