Prettier config generator

Pick how your code should look — line width, indentation, quotes, semicolons, trailing commas — and copy a .prettierrc. By default only the options you changed are written, so the file stays short and readable.

Prettier wraps lines longer than this. Default 80.
Spaces per indentation level. Default 2.
Quotes around object keys (quoteProps)
Trailing commas (trailingComma)
Parentheses around a single arrow parameter (arrowParens)
Wrap Markdown text (proseWrap)

Save as .prettierrc in the project root. Prettier 3 reads it automatically; run npx prettier . --write to format the project.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Set the line width and indentation.
  2. Choose quotes, semicolons and trailing commas — the options that change the look of code most.
  3. Adjust the rest if you need to, for example Windows line endings or Markdown wrapping.
  4. Copy the result into .prettierrc in the project root and run npx prettier . --write.

How it works

Each control is one Prettier option; its name is in brackets in the label. The output is JSON. With “only options that differ” ticked, every value equal to the Prettier 3 default is left out, so a future default change applies to settings you did not choose on purpose.

Option Default Effect
printWidth 80 Line width Prettier wraps at
tabWidth / useTabs 2 / false Indentation
semi true Semicolons at statement ends
singleQuote false ’ instead of “ in JavaScript
trailingComma all Commas after the last item in lists
arrowParens always (x) => x or x => x

Example

The form starts with line width 100 and single quotes, everything else at the defaults. The result is:

{
  "printWidth": 100,
  "singleQuote": true
}

Untick the last option and the file lists all 13 options with their values.

Tips

  • Commit .prettierrc and add a .prettierignore for generated files.
  • Turn on “format on save” in your editor so files are formatted as you work.
  • With ESLint, add eslint-config-prettier so ESLint does not report formatting that Prettier handles.

Frequently asked questions

Why are some options missing from the file?

With the last option ticked, only settings that differ from Prettier's defaults are written. Untick it to list every option, for example to make the choice explicit for a team.

What are Prettier's defaults?

In Prettier 3: printWidth 80, tabWidth 2, no tabs, semicolons on, double quotes, quoteProps as-needed, trailingComma all, bracketSpacing on, bracketSameLine off, arrowParens always, endOfLine lf and proseWrap preserve. Prettier 3 changed the trailingComma default from es5 to all.

Is printWidth a hard limit?

No. It is the width Prettier aims for. Long strings, URLs or deeply nested code can still produce longer lines.

Does .prettierrc also work as YAML?

Yes, Prettier reads .prettierrc as JSON or YAML. The tool writes JSON, which is valid in both cases.

Should I use Prettier together with EditorConfig?

They work well together. The Prettier command line also reads indent style, indent size, line width and line endings from .editorconfig when .prettierrc does not set them.

More in Developer

All tools in this category: Developer ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.