Emmet is a built-in VS Code feature that expands short abbreviations into full HTML and CSS. You type a CSS selector-like expression, press one key, and VS Code produces the complete markup or style.
No extension is required. Emmet is active by default in HTML, CSS, SCSS, Less, JSX, XML, Pug, Haml, and Slim files. For more on VS Code editing features, see how to use multiple cursors. If you want to create your own abbreviations, check out custom code snippets.
Your first abbreviation
Open an HTML file. Type ! and press Tab or Enter. VS Code expands it into a full HTML5 document skeleton.
Now type ul>li*5 and expand it.
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>The expression means an unordered list containing a list item, repeated 5 times.
Essential Emmet syntax
Emmet abbreviations use a small set of operators. Learn these and you can produce most markup:
| Syntax | Meaning | Example | Result |
|---|---|---|---|
| > | Child element | div>p | div containing p |
| + | Sibling element | div+p | div followed by p |
| *N | Repeat N times | li*3 | Three li elements |
| .class | Add class | div.container | div with class container |
| #id | Add ID | div#header | div with id header |
{} | Text content | p{Hello} | p containing the text Hello |
| $ | Auto-numbering | li.item-$*3 | li elements numbered item-1, item-2, item-3 |
| () | Grouping | (div>p)+(div>span) | Two separate divs |
You can combine these freely. This expression creates a div with an ID, containing a list with three numbered items and links:
div#page>ul>li.item-$*3>a{Link $}Auto-numbering with $
The $ symbol increments with each repetition.
Use two dollar signs for two-digit padding, like 01 or 02. Use $@- to count down. This example creates three image tags with padded numbers:
<img src="photo-01.jpg" alt="">
<img src="photo-02.jpg" alt="">
<img src="photo-03.jpg" alt="">Lorem ipsum text
Emmet also expands the word lorem into placeholder text. Add a number for word count, like lorem5 for 5 words. Combine it with multiplication, like p*3>lorem5, to produce 3 paragraphs of 5 words each.
CSS abbreviations
Emmet works the same way in CSS files. Type a shorthand and expand it:
| Abbreviation | Result |
|---|---|
| m10 | margin: 10px; |
| p20-10 | padding: 20px 10px; |
| w100p | width: 100%; |
| bgc#fff | background-color: #fff; |
| fwb | font-weight: bold; |
| tac | text-align: center; |
| bdrs50p | border-radius: 50%; |
| df | display: flex; |
CSS abbreviations use fuzzy search. Typing pos:a matches position: absolute, and pos:r matches position: relative. The part before the colon matches a property name, and the part after matches a value.
Expand abbreviations
There are three ways to expand an Emmet abbreviation:
Tab key
Set emmet.triggerExpansionOnTab to true in settings. Type an abbreviation and press Tab.
Enter from the suggestion list
As you type, Emmet suggestions appear in the IntelliSense list. Press Enter on one to expand it.
Emmet: Expand Abbreviation command
Run it from the Command Palette. You can bind it to any keyboard shortcut.
The suggestion list shows a live preview of the expanded abbreviation in the documentation panel. This helps you verify the output before you commit.
Wrap existing text with Emmet
Select some text, open the Command Palette, and run Emmet: Wrap with Abbreviation. Type your abbreviation and press Enter. The selected text is placed inside the expanded structure.
For example, select three lines of text and wrap with ul>li*:
<ul>
<li>First selected line</li>
<li>Second selected line</li>
<li>Third selected line</li>
</ul>Enable Emmet in other file types
To use Emmet in JSX inside .js files, in Vue single-file components, or in other file types where it is not active by default, add the emmet.includeLanguages setting:
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"vue-html": "html",
"plaintext": "pug"
}The left side is the language ID of the file you are editing. The right side is the Emmet-supported language whose syntax rules to use.
Language IDs are not always the same as file extensions. To find the correct language ID, open the file and look at the language indicator in the Status Bar. Click it to see the list of available language identifiers.
Emmet with multiple cursors
Emmet abbreviations can be expanded independently at each cursor. Place multiple cursors across different lines, type the same abbreviation at each one, and expand. Every cursor gets its own expansion. Combined with auto-numbering, this is a fast way to generate repeated but varied markup.
Customize Emmet output
Add to your settings to control how abbreviations expand:
"emmet.syntaxProfiles": {
"html": {
"attr_quotes": "single"
}
}This changes all HTML attribute quotes from double to single.
Useful abbreviation reference
| What you want | Abbreviation |
|---|---|
| HTML5 boilerplate | ! |
| Div with class | .classname |
| Div with ID | #idname |
| Link tag | link:css |
| Script tag with src | script:src |
| Form with input and button | form>input:text+button:submit |
| Table with header and rows | table>tr>th3^^tr3>td*3 |
| Inline style tag | style |
| Meta viewport | meta:vp |
The full reference is available at the Emmet Cheat Sheet.
Rune AI
Key Insights
- Emmet is built into VS Code. No extension installation needed. It works in HTML, CSS, JSX, Pug, and other markup files by default.
- Key abbreviations: ! for HTML5 skeleton, .class for div with class, #id for div with id, > for child, + for sibling, *N for repetition, $ for numbering.
- Press Tab (with emmet.triggerExpansionOnTab) or Enter to expand an abbreviation. The suggestion list shows a live preview as you type.
- Use Emmet: Wrap with Abbreviation from the Command Palette to wrap existing text or code in new HTML structure.
- Enable Emmet in other file types with emmet.includeLanguages: add mappings like "javascript": "javascriptreact" for JSX support.
Frequently Asked Questions
Does Emmet work in JSX and React files?
How do I expand Emmet abbreviations with Tab instead of Enter?
Why is my Emmet abbreviation not expanding?
How do I wrap existing text in an HTML tag with Emmet?
Conclusion
Emmet turns short CSS-like expressions into full HTML and CSS. It is built into VS Code with no extension needed. Type a CSS selector-like abbreviation, press Tab or Enter, and watch it expand. Use multiplication for repeated elements, curly braces for text content, and id and class shortcuts. Enable it in JSX and Vue files with the emmet.includeLanguages setting.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.