# Abbreviate units of measurement (EK00050)

import { Aside, Badge } from '@astrojs/starlight/components';

Abbreviating a unit after a number — 5 px rather than 5 pixels — keeps measurements short and consistent across your documentation. EkLine flags a spelled-out unit of measurement after a number and suggests the abbreviation (rule EK00050).

## Why abbreviate units of measurement in documentation?

Measurements appear often in technical writing, and mixing "5 pixels" with "5 px" on different pages makes the content look unedited. Abbreviated units are shorter, scan faster in tables and code, and match how measurements appear in interfaces, specs, and libraries. One convention keeps your numbers predictable for readers.

## What EkLine flags

EK00050 matches a spelled-out unit of measurement — such as meters, grams, pixels, inches, miles, or pounds — after a number and suggests the abbreviation.

- ❌ **Incorrect:** Add a 5 pixels border around the element.
- ✅ **Correct:** Add a 5 px border around the element.
- ❌ **Incorrect:** The cable is 10 meters long.
- ✅ **Correct:** The cable is 10 m long.

## How to fix

Replace the spelled-out unit with its abbreviation, such as `m` for meters, `g` for grams, or `px` for pixels.

<Aside type="note">
When the unit is part of prose rather than a measurement — for example, "the last few meters of the route" — keep the word and ignore the rule for that line.
</Aside>

## FAQ

### Should you write "5 px" or "5 pixels"?

Use the abbreviation, "5 px". Abbreviated units are shorter, scan faster in tables and code, and match how measurements appear in interfaces and specs.

### When should you keep the spelled-out unit?

When the unit is part of prose rather than a measurement — for example, "the last few meters of the route" — keep the word and ignore the rule for that line.

## Rule details

| Property | Value |
|----------|-------|
| Rule ID | `EK00050` |
| Category | Consistency |
| Default severity | <Badge text="Error" variant="danger" /> |
| Enabled by default | Yes |

## Ignore this rule

To keep a spelled-out unit on one line, add an inline comment with a reason:

```markdown
<!-- ekline-ignore-next-line EK00050 -- descriptive prose, not a measurement -->
You are just a few meters from the finish.
```

To disable the rule across your project, add it to the `ignore` list in your [configuration file](/reviewer/configuration/ignoring-rules/#ignore).

## Related rules

- [EK00054](/reviewer/rules/data-measurements/) — Format data measurements consistently
- [EK00055](/reviewer/rules/time-measurements/) — Use numerals for time measurements