The safe filter tells Django that template output already contains trusted HTML, so automatic escaping does not turn tags into visible text. Use {{ value|safe }} when the value should render as HTML rather than appear as escaped characters. section 3.7
Rendering HTML in a template
With instrument set to <b>sax</b>, {{ instrument }} renders <b>sax</b>, while {{ instrument|safe }} renders the bold sax text. The filter changes escaping behavior; it does not create the HTML.
Django also supports the escape filter and the autoescape tag. For dynamically built snippets, mark_safe() returns a SafeString, while format_html() constructs formatted HTML as a SafeString. section 3.7
