# Custom Pipe

Your own template formatter, written as a class with a \`transform\` method.

## What is **Custom Pipe**?

A **custom pipe** is your own template formatter. Write a class with a `transform` method and the `@Pipe` decorator.

```typescript
@Pipe({ name: 'minutes' })
export class MinutesPipe implements PipeTransform {
  transform(total: number) {
    return `${Math.floor(total / 60)}h ${total % 60}m`;
  }
}

// {{ 135 | minutes }}  ->  2h 15m
```

Level: Journeyman · [More Angular terms at this level](https://www.ask-codey.com/glossary?category=angular&level=3)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/custom-pipe
