.css

What is a .css file?

Cascading Style Sheets · Code and data · W3C · 1996

CSS is the styling language of the web. It tells the browser how HTML should look: colours, fonts, spacing and layout. A CSS file is plain text, separate from the HTML it decorates, which keeps content and design apart.

Category
Code and data
MIME type
Type
Plain text
Is a .css file safe to open? Safe. CSS only styles content and cannot execute program logic.

What is a .css file used for?

CSS applies visual rules to HTML elements, controlling everything from colour and typography to responsive layouts and animations.

Keeping style in separate .css files lets one stylesheet shape an entire site and makes design changes painless.

Like HTML, it is plain text you can open and edit in any code editor.

What opens a .css file?

The .css format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.

Windows

  • VS Code
  • Notepad++
  • any editor

macOS

  • VS Code
  • any editor

Linux

  • VS Code
  • any editor

Web

  • Browser dev tools show applied CSS

Open a .css file step by step

  1. Confirm the file really is a .css. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with VS Code or Notepad++.
  3. On Mac, use VS Code or any editor.
  4. On Linux, try VS Code or any editor.
  5. Still stuck? Convert the .css to TXT, which opens more widely.

Why can't I open my .css file?

Almost always because no installed app understands CSS. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .css at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

How to convert a .css file

You can convert a .css file to TXT using a conversion tool or the export menu of an app that opens it.

CSS has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.

Frequently asked questions

What is a .css file?

CSS is the styling language of the web. It tells the browser how HTML should look: colours, fonts, spacing and layout. A CSS file is plain text, separate from the HTML it decorates, which keeps content and design apart.

Can I open a CSS file in a browser?

A browser will show the raw text but not apply it visually on its own. To see its effect, it must be linked from an HTML page.

Related formats

Sources

Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.