---
title: '|rjust'
description: right justifies a value within text of `n` characters
date: '2026-08-02'
categories:
  - Filter
  - Formatting
canonical: https://www.djangotemplatetagsandfilters.com/filters/rjust/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#rjust
---

# |rjust

right justifies a value within text of `n` characters

## Documentation

Right justifies a value by padding it with whitespace on the left.

### Variable

```django
company = 'Webucator'
```

### Template

```django
{{ "company|rjust:20" }}
```

### Result

```django
"           Webucator"
```

In a browser, whitespace is condensed, so the output would be:

" Webucator"

## Commentary

As whitespace is condensed by default in HTML pages, alignment filters will not affect the output unless the text is within a `pre` element or CSS is used to prevent whitespace from being condensed. However, Django can be used to create non-HTML documents as well. In such documents, formatting with whitespace might make more sense.
