# How to automatically run Prettier on all files in a project

> Learn how to run Prettier across every file in your project by adding a .prettierrc config and running npx prettier -w . to format them all at once.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2023-12-05 | Topics: [Tools](https://flaviocopes.com/tags/tools/) | Canonical: https://flaviocopes.com/how-to-automatically-run-prettier-on-all-files-in-a-project/

Create a `.prettierrc` file in your project, for example

```json
{
  "tabWidth": 2,
  "useTabs": false,
  "semi": false
}
```

Then run

```css
npx prettier -w .
```

If you just need to tidy one snippet before committing, I built a free [code beautifier](https://flaviocopes.com/tools/code-beautifier/) that formats HTML, CSS, and JavaScript in the browser.
