How to Enable Word Wrap in VS Code
Word wrap in Visual Studio Code — you will also see it called line wrap or text wrap — automatically moves long lines of code or text onto the next line instead of letting them run off the right edge. It makes files far easier to read and edit in VS Code, especially on a smaller screen.
Enable Word Wrap via Menu
- Open your file in VS Code.
- Go to the top menu and select View > Word Wrap.
- Alternatively, use the command palette (
Cmd+Shift+Pon Mac orCtrl+Shift+Pon Windows/Linux), then type and selectToggle Word Wrap.
- Alternatively, use the command palette (
Enable Word Wrap via Settings
- Open Settings (
Cmd+,on Mac orCtrl+,on Windows/Linux).

- Search for
word wrap. - Set Editor: Word Wrap to
on.

Alt+Z: The Word Wrap Keyboard Shortcut
Press Alt+Z (Windows and Linux) or Option+Z (Mac) to toggle word wrap on or off in the editor. This is the quickest way to wrap text in VSCode and the shortcut most people are looking for.
The official VS Code documentation describes Alt+Z as toggling word wrap for the VS Code session — it is not written to your settings, so it does not survive a restart. To make line wrap permanent, use the setting in the next section instead.
Make Word Wrap the Default in VSCode
The menu and the shortcut both wrap only the current file. To turn line wrap on for every file you open:
- Open Settings (JSON view).
- Add the following line:
"editor.wordWrap": "on"
Per the official documentation, editor.wordWrap defaults to off; setting it to on wraps text at the width of the editor's viewport. Unlike Alt+Z, this is saved in your settings and applies every time you open VS Code.
Now you can enjoy better readability and a cleaner editing experience in VS Code!
Additional Resources
- Basic editing — VS Code official docs — the "How do I turn on word wrap?" section, covering
Alt+Zand theeditor.wordWrapsetting. - How to Enable Word Wrap in Visual Studio — the same task in the full Visual Studio IDE, which uses a different setting and a different shortcut.
