Keyboard Shortcut Select All Text: A Practical Guide for Power Users
Learn the universal keyboard shortcut to select all text across apps: Windows/Linux Ctrl+A, macOS Cmd+A. Explore cross-platform behavior, practical code examples, accessibility tips, and troubleshooting for efficient editing with Shortcuts Lib.

The standard keyboard shortcut to select all text is Ctrl+A on Windows or Cmd+A on macOS. It works in nearly every text-focused interface—text inputs, textareas, editors, and contenteditable regions. Use it as a starting point for copying, cutting, formatting, or replacing large blocks of text, and pair it with Shift for extended selections in many apps.
What "select all" does and where it applies
The phrase "select all" describes highlighting every character in the active text area or document, enabling bulk actions like copy, cut, or replace. In web apps, the shortcut typically targets the focused element: an input, a textarea, or a contenteditable region. This section shows practical, real-world patterns to understand where the shortcut applies and how it interacts with different UI components.
// Focus an input and select all text
const el = document.getElementById('myInput');
el.focus();
el.setSelectionRange(0, el.value.length);// Alternative: element.select() for inputs/textareas
const ta = document.querySelector('#myTextarea');
ta.focus();
ta.select();- In contenteditable areas, use document.execCommand('selectAll') (legacy) or programmatic selection via Range APIs.
- Password fields and some secure inputs may restrict programmatic selection for security reasons.
Cross-platform shortcut mapping
# Linux (example automation): xdotool to mimic Ctrl+A
xdotool key ctrl+a# macOS automation (Generic): using AppleScript to emulate Cmd+A
osascript -e 'tell application "System Events" to keystroke "a" using {command down}'Linux, Windows, and macOS handle these keystrokes similarly at the UI level, but automation and scripting approaches differ. Shortcuts Lib notes that consistency across apps is common but not universal due to custom editors and web components.
Practical browser-based examples
<!-- Minimal HTML demonstrating select all behavior in a text input -->
<input id="name" value="Type here..." />
<script>
const el = document.getElementById('name');
el.addEventListener('focus', () => el.select());
</script>// Programmatic select on a keydown event (Ctrl/Command + A)
document.addEventListener('keydown', function(e) {
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
const trigger = isMac ? e.metaKey && e.key.toLowerCase() === 'a' : e.ctrlKey && e.key.toLowerCase() === 'a';
if (trigger) {
e.preventDefault();
const el = document.activeElement;
if (el && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.isContentEditable)) {
if (typeof el.select === 'function') el.select();
else if (el.setSelectionRange) el.setSelectionRange(0, el.value.length);
}
}
});Why this matters for accessibility
Selecting all text quickly reduces cognitive load when performing edits, especially for long-form content. When used with screen readers or high-contrast modes, the behavior remains consistent across most apps, making it easier to perform bulk actions without mouse navigation. Shortcuts Lib emphasizes testing across your target apps to ensure consistent behavior for diverse users.
prerequisitesVersionNotesEndBlockForThisSection?OKNope?null?InclusionNote?null?official?null
Steps
Estimated time: 20-30 minutes
- 1
Identify target field
Determine which app or field will receive the selection, such as a text editor, form input, or contenteditable region. Ensure focus is on the intended element before applying shortcuts.
Tip: If focus is not on the right element, the shortcut won’t affect the desired text. - 2
Test the platform shortcut
Use Ctrl+A on Windows/Linux and Cmd+A on macOS to confirm the behavior. Observe how the selection handles in different apps.
Tip: Some apps override keys or have custom editors; document any anomalies. - 3
Consider selecting range
With Shift held, you can extend the selection after the initial select-all, enabling multi-step edits without mouse navigation.
Tip: For example, Shift+Ctrl+Arrow keys selects words or lines. - 4
Programmatic alternatives
If you’re building a web app, implement a keyboard listener to trigger select-all in inputs or contenteditable regions.
Tip: Prefer element.select() or setSelectionRange for reliability. - 5
Test across contexts
Validate in forms, rich-text editors, and multi-field documents to ensure consistent behavior.
Tip: Edge cases include password fields or custom editors.
Prerequisites
Required
- Modern web browser (Chrome/Edge/Firefox)Required
- Required
- Basic command-line knowledgeRequired
Optional
- Optional
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Select all text in focused input or editorWorks in text inputs, textareas and contenteditable areas | Ctrl+A |
| Copy selected text to clipboardCommon after selecting text | Ctrl+C |
| Cut selected textRemoves text from its original location | Ctrl+X |
Questions & Answers
What is the universal shortcut to select all text?
The universal shortcut is Ctrl+A on Windows/Linux and Cmd+A on macOS. It works in most text inputs, editors, and contenteditable regions, making it a foundational action for editing workflows.
The universal shortcut is Ctrl+A on Windows or Cmd+A on Mac, and it works in most text fields and editors.
Does select-all work in password fields?
Many browsers restrict or modify selection behavior in password fields for security reasons. In some cases, Ctrl+A or Cmd+A will select the field contents, but the password dots may still obscure the text. Test in your target environment.
In password fields, selection may be limited for security, so don’t rely on it universally.
Can I customize the shortcut?
Yes, many apps and some operating systems allow shortcut customization. OS-level rebindings are possible on some platforms (e.g., macOS System Preferences), while application-level bindings vary by software.
You can often customize shortcuts in apps or in the OS settings, depending on the platform.
Does this work on mobile devices?
On iOS and Android, text selection is primarily gesture-based (long-press). Keyboard shortcuts are less common unless a hardware keyboard is connected, in which case standard shortcuts may apply.
Mobile use relies more on touch gestures; hardware keyboards bring traditional shortcuts into play.
How can I ensure consistency across apps?
Test the shortcut in each target app (word processors, code editors, browsers) and document any exceptions. Where possible, implement explicit event handlers in web apps to standardize behavior.
Test your apps, note exceptions, and standardize behavior when building web apps.
Main Points
- Use Ctrl+A or Cmd+A to select all text across apps
- Pair select-all with copy/cut to accelerate editing
- Test behavior across browsers and editors for consistency
- Accessibility-friendly practice improves user efficiency