---
title: '|filesizeformat'
description: converts a value in bytes to a friendly file size format.
date: '2026-08-02'
categories:
  - Filter
  - Number
canonical: https://coolify.djangotemplatetagsandfilters.com/filters/filesizeformat/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#filesizeformat
---

# |filesizeformat

converts a value in bytes to a friendly file size format.

## Documentation

Converts a value in bytes to a friendly file size format.

### Variable

```django
files = [
    {
        'filename': 'macOS 64-bit installer',
        'filesize': 29163525
    },
    {
        'filename': 'Windows x86-64 executable installer',
        'filesize': 26797616
    },
    {
        'filename': 'Windows x86-64 web-based installer',
        'filesize': 1348896
    }
]
```

### Template

```django
<ol>
  {% for file in files %}
    <li>{{ file.filename }} ({{ file.filesize|filesizeformat }})</li>
  {% endfor %}
</ol>
```

### Result

```django
<ol>
  <li>macOS 64-bit installer (27.8 MB)</li>
  <li>Windows x86-64 executable installer (25.6 MB)</li>
  <li>Windows x86-64 web-based installer (1.3 MB)</li>
</ol>
```

## Commentary

Useful when outputting the file size of a downloadable file.
