Developer 도구 업데이트됨 1주 전

Free CSS Formatter Online

CSS Beautify parses a minified or badly indented stylesheet and prints it again with one declaration per line, indented blocks and readable spacing. Paste CSS or fetch a public URL, then copy or download the formatted file.

CSS Formatter Beautify CSS Clean Styles Online Tool

사용법 Free CSS Formatter Online

코드 파일의 직접 URL을 붙여넣으면 해당 내용이 편집기에 불러옵니다.

출력

완료
도구 링크
클립보드에 복사되었습니다.
이 도구를 개선하는 데 도움을 주세요
80
소요 시간
72
총 사용자 수
5+ 년
제공됨
최종 검토일: 2주 전. 사용량 수치는 정기적인 감사 과정에서 갱신됩니다. (보고 시작일: 21 Feb 2022)
불일치 신고하기

내용 읽기

이 도구의 작동 방식과 사용 시기를 알아보세요.

What this page is for

Minified CSS is efficient for a browser and painful for a person. A single line can contain hundreds of rules, and a missing brace becomes almost impossible to spot. This page parses the stylesheet, rebuilds the rule tree and prints it with consistent line breaks and indentation so you can read, review or repair it.

The page opens with CSS and Beautify already selected and accepts up to 200,000 characters per run. Processing happens on the server. The output is a formatted stylesheet, not a different stylesheet: the selectors and declarations are meant to survive the pass unchanged.

How the formatter works

The server hands the source to a CSS parser, which builds a tree of rules, at-rules, declarations and comments. The tree is then rendered with a pretty output format. That format puts a newline before and after each rule, separates blocks with a blank line and prints one declaration per line.

The parser indents nested blocks with a tab character by default. If your project uses spaces, the output will not match your style guide, but it will still be readable. Treat this page as a viewer and a repair aid rather than a substitute for the formatter configured in your editor.

What the output looks like

Selectors are separated from the opening brace by a single space character. Declarations are printed one per line with a colon and a space after the property name. Closing braces sit on their own line. At-rules such as @media and @supports receive a block, and the rules inside are indented one level deeper. Comments that the parser recognises are printed as comments.

Long values are not wrapped, so a custom property holding a very long gradient stays on one line. That is normal: CSS has no safe generic line-breaking rule for values.

Which comments survive

Comments at the top level and between rules are printed, so a section banner usually survives the pass. A comment placed inside a declaration block is a different case: testing this page shows that it can be dropped, because the parser treats it as part of the block rather than a standalone node. Keep important notes outside rule blocks if you need them to survive.

Do not rely on beautifying to recover comments from an already-minified file. They were removed by the minifier, and no formatter can bring them back.

What can change in the output

Formatting should not change meaning, but a parser-based pass can normalise small details. Quotes may be standardised, extra whitespace inside values may be collapsed, and empty declarations may disappear. Vendor-specific hacks that are not valid CSS, such as the old star hack or underscore hack, may be rejected by the parser or printed differently.

If a stylesheet depends on those hacks, keep the original. The same applies to files that contain template syntax: a CSS parser does not understand Blade, Twig or JavaScript expressions embedded in property values, and it may fail or produce a broken tree.

Modern CSS and parser support

CSS nesting, @layer, @container and @scope are newer than many PHP CSS parsers. A parser that does not understand nesting may treat the nested block as a syntax error, drop it, or flatten it incorrectly. Check the output for any construct introduced in the last few years before you use it.

If the parse fails, the page returns an error rather than a partial stylesheet. That is safer than silent corruption, but it means a single unsupported rule can block the whole file. In that case, format the file in your editor or split out the unsupported section.

Fetching CSS from a URL

The URL tab downloads a public stylesheet on the server and puts the response in the editor. The fetch is capped at 200,000 characters. CDN links usually work; authenticated links, bot-protected links and signed URLs usually do not. The server fetches the raw response, so an HTML error page will arrive as HTML and fail to parse as CSS.

Step by step

  1. Paste the stylesheet into Manual Code, or load it with the URL tab.
  2. Confirm the language is CSS and the mode is Beautify.
  3. Press Process Code.
  4. Read the output from the top: a broken brace is much easier to see once every block is indented.
  5. Copy the formatted CSS, or download it as beautify-output.css.
  6. Compare the selectors and declarations with the original before replacing anything.

When beautifying helps

It helps when you need to review a vendor stylesheet before overriding it. It helps when a minified file misbehaves and you want to find the rule that wins. It also helps when you are learning CSS and want to see how a real framework organises its selectors.

It is less useful as a commit step. Reformatting an entire file creates a large diff that hides the actual change. If you only need to read the file, beautify a copy and leave the repository version alone.

Checking the result

Compare the number of rules and the number of declarations in the input and output. A sudden drop usually means the parser rejected a construct. Load a page that uses the stylesheet and check layout, colours, fonts and responsive breakpoints. Pay particular attention to hacks, custom properties and anything that uses a preprocessor-style expression.

Reading a vendor stylesheet

When a framework rule overrides yours, the fastest way to find it is to search the formatted file for the selector and read the surrounding block. Minified CSS puts every rule on one line, so a search hit gives you very little context. After beautifying, each selector starts its own line and each declaration sits underneath it, which makes the cascade much easier to follow.

Keep the formatted copy outside your project. Editing a vendor file directly is fragile because the next package update replaces it. Copy the rule you need into your own stylesheet and override it there.

Print and accessibility blocks

Stylesheets often contain @media print, @media (prefers-reduced-motion) and @media (prefers-color-scheme) blocks near the end. These are easy to miss in a minified file and easy to break when a parser does not support the query syntax. After formatting, scan the at-rules and confirm that each block still has its declarations. Then test print preview and the reduced-motion setting if the page supports them.

Limits

One stylesheet per run, 200,000 characters, CSS mode on this page. The code is processed on the server and returned; it is not stored. The tool does not lint, validate, autoprefix or check browser support. It does not guarantee that the output is byte-identical to the input, only that it is intended to be equivalent CSS.

Frequently Asked Questions

자주 묻는 질문

사용자가 결과를 신뢰하기 전에 자주 묻는 질문에 대한 간결한 답변.

It should not, because formatting does not change selectors or values. Parser normalisation and unsupported syntax are the exceptions, so compare the rendered page.

Top-level comments and comments between rules are printed. A comment inside a declaration block may be dropped. Comments already removed by a minifier cannot be recovered.

The pretty format uses a tab per nesting level by default. The page does not expose an indentation setting.

No. Those languages have variables, mixins and nesting that a plain CSS parser may reject. Compile them to CSS first.

The parser may not support CSS nesting. Keep the original and use a formatter that understands the newer syntax.

No. It only changes formatting. Removing unused CSS requires a build tool that can inspect the HTML and JavaScript that use the stylesheet.

It is sent to the server for formatting and returned in the response. The tool does not store it.

댓글 (0)

사용자 토론, 예외적인 사례 및 추가 팁을 위한 공간입니다.
댓글 남기기
댓글을 제출하면 공개적으로 표시됩니다.
아직 댓글이 없습니다. 가장 먼저 댓글을 남겨보세요!
저희에게 알려주세요!
이 도구와 관련된 문제를 신고하기

발생한 문제를 자세히 설명해 주시면, 저희가 이를 조사하고 도구를 개선할 수 있습니다.

가장 도움이 되는 것은 무엇인가
입력 내용, 예상 결과, 실제 결과, 브라우저/기기 정보를 기재해 주시고, 도움이 될 경우 스크린샷도 첨부해 주세요.
스크린샷 버튼은 브라우저에 표시된 페이지를 캡처하여 생성된 이미지를 이 양식에 첨부합니다.
전체 화면 스크린샷
newisty를 통해 브라우저에서 캡처되었습니다.
아직 스크린샷을 찍지 않았습니다.
도구 보고서