---
title: '{% static %}'
description: builds a URL for a static file.
date: '2026-08-21'
categories:
  - Template Tag
  - Utility
canonical: https://www.djangotemplatetagsandfilters.com/tags/static/
doc_link: https://docs.djangoproject.com/en/6.1/ref/templates/builtins/#static
---

# {% static %}

builds a URL for a static file.

## Documentation

Builds the URL for a file in your static files, so the path in the template stays correct when `STATIC_URL` changes or a storage backend adds a content hash.

### Template

```django
{% load static %}
<img src="{% static "img/logo.png" %}" alt="Logo">
```

### Result

```django
<img src="/static/img/logo.png" alt="Logo">
```

Hardcoding `/static/…` works right up until it does not: a CDN, a different prefix, or a hashed filename in production all break it, and this tag is the reason none of them are your problem.
