A Flask page can render perfectly and still leave the browser tab blank when the project has no favicon link. The cleanest flask favicon setup stores the icon in Flask's static directory and links it from your shared Jinja template.

What do you need before you start?

How do you add a flask favicon in five steps?

  1. 1. Place the icon in the static directory

    Create these folders if they do not exist, then put the file here:

    myapp/
    ├── app.py
    ├── static/
    │   └── favicon.ico
    └── templates/
        └── base.html

    Do not rename a PNG to favicon.ico; use a real ICO. For PNG and SVG link formats, see the HTML favicon guide.

  2. 2. Add the link to your base template

    The HTML Standard defines rel='icon' links to external icon resources. Add this block inside the existing <head> in templates/base.html:

    {% block head %}
      <link rel='icon' href='{{ url_for('static', filename='favicon.ico') }}'>
    {% endblock %}

    Using url_for avoids hard-coded paths when the app uses a URL prefix or custom static path.

  3. 3. Make each page inherit it

    Extend the base template from each page. If its head block has another name, substitute that name below:

    {% extends 'base.html' %}
    {% block head %}
      {{ super() }}
    {% endblock %}

    The super() call preserves the favicon while letting each page add more head content.

  4. 4. Run and verify the response

    Start the development server and open the icon URL directly:

    flask --app app run --debug
    # Open http://127.0.0.1:5000/static/favicon.ico

    The direct request should return the icon, not HTML or a 404. Inspect the rendered <head> and confirm it contains the rel='icon' link generated by url_for.

  5. 5. Deploy with a stable public URL

    Serve static/favicon.ico as a static asset in production, not through an application route. Keep the filename stable; when replacing an old icon, use favicon-v2.ico and update the template to avoid a stale cached copy.

What usually breaks?

When is the Flask favicon setup complete?

The setup is complete when the direct icon URL returns the file and every page inherits the rel='icon' declaration. Need source artwork? Mzu favicondl can prepare favicon files before you add them to Flask.