# format (/docs/cli/format)

Location: CLI > format

The `prisma format` command formats your Prisma schema file. It validates, formats, and persists the schema.

Usage [#usage]

```bash
prisma format [options]
```

Options [#options]

| Option         | Description                            |
| -------------- | -------------------------------------- |
| `-h`, `--help` | Display help message                   |
| `--config`     | Custom path to your Prisma config file |
| `--schema`     | Custom path to your Prisma schema      |

Examples [#examples]

Format the default schema [#format-the-default-schema]

  

#### npm

```bash
npx prisma format
```

#### pnpm

```bash
pnpm dlx prisma format
```

#### yarn

```bash
yarn dlx prisma format
```

#### bun

```bash
bunx --bun prisma format
```

Output on success:

```text
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Formatted prisma/schema.prisma in 116ms
```

Format a specific schema [#format-a-specific-schema]

  

#### npm

```bash
npx prisma format --schema=./alternative/schema.prisma
```

#### pnpm

```bash
pnpm dlx prisma format --schema=./alternative/schema.prisma
```

#### yarn

```bash
yarn dlx prisma format --schema=./alternative/schema.prisma
```

#### bun

```bash
bunx --bun prisma format --schema=./alternative/schema.prisma
```

Error output [#error-output]

If the schema has validation errors, formatting will fail:

```text
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: The preview feature "unknownFeatureFlag" is not known. Expected one of: [...]
  schema.prisma:3
   |
 2 |     provider        = "prisma-client"
 3 |     previewFeatures = ["unknownFeatureFlag"]
   |

Validation Error Count: 1
```

## Related pages

- [`db`](https://www.prisma.io/docs/cli/db): Manage your database schema and lifecycle during development
- [`debug`](https://www.prisma.io/docs/cli/debug): Display Prisma debug information including schema paths, engine binaries, environment variables, and cache directories for troubleshooting
- [`dev`](https://www.prisma.io/docs/cli/dev): Start a local Prisma Postgres server for development
- [`generate`](https://www.prisma.io/docs/cli/generate): Generate artifacts like Prisma Client based on your Prisma schema
- [`init`](https://www.prisma.io/docs/cli/init): Set up a new Prisma project in the current directory