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.
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.
How to open 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. For a step-by-step walkthrough, see how to open a .css file.
Windows
- VS Code
- Notepad++
- any editor
macOS
- VS Code
- any editor
Linux
- VS Code
- any editor
Web
- Browser dev tools show applied CSS
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 file signature (magic bytes)
Programs recognise a .css file by the bytes at the start of the file, not by its name. These are the signatures for CSS.
| Hex signature | Offset | Note |
|---|---|---|
| (no fixed signature) | 0 | no fixed signature; plain text rules |
See the full magic-numbers reference for every format.
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: