Less Than Symbol Keyboard Shortcut: How to Type '<' Anywhere
Learn to type the less-than symbol quickly on Windows and macOS, explore ASCII codes, HTML escaping, and editor-friendly shortcuts with practical examples from Shortcuts Lib.

The less-than symbol (<) is produced by Shift + comma on Windows and macOS in standard layouts. You can also enter it with Alt+60 on Windows using the numeric keypad, or via Unicode input when enabled. In HTML or templates, use < to avoid misinterpretation. According to Shortcuts Lib, mastering these variants speeds typing and reduces typos.
What is the less-than symbol keyboard shortcut?
The less-than symbol is a fundamental character used in mathematics, comparisons, and markup languages like HTML. The standard way to type it on most US keyboard layouts is to press Shift + the comma key. While this single keystroke works in most editors and shells, there are alternative entry methods for specific workflows (such as ASCII entry, Unicode input, or HTML escaping). Understanding these variants helps you stay efficient when working with code, documentation, or data pipelines. This section also aligns with the keyword less than symbol keyboard shortcut to ensure consistency across guides and search results.
Quick facts
- Primary method: Shift + comma
- Alternate entry: Alt+60 (Windows, numeric keypad)
- HTML templates: use < to render the symbol safely
Typing '<' on Windows and macOS
The most universal way to type '<' on Windows and macOS (with a US keyboard layout) is the same shortcut: Shift + comma. This keeps the keystroke simple and consistent across platforms.
# Python example: simple string containing less-than
print('<') # outputs: <# Bash example: print the character
echo '<' # outputs: <In editors and IDEs, this shortcut behaves the same, ensuring you can type code and documentation without leaving your hands on the keyboard.
ASCII/Alt code and Unicode input
Some workflows benefit from explicit ASCII or Unicode entry, especially when the physical key is unavailable or when using remote terminals. Windows supports an ASCII entry via the numeric keypad, while macOS offers Unicode input options if enabled in accessibility settings.
# Windows PowerShell: ASCII via Alt code (60 -> '<')
Write-Output [char]60 # outputs: <# Alternative: entering via Unicode in a compatible terminal
printf '\x3C' # outputs: <Note: Alt+60 is not guaranteed on all keyboards; some laptops or international layouts may require different codes. Always test in your environment. Shortcuts Lib recommends using the standard Shift+Comma where possible for reliability.
HTML escaping and templates
When embedding the less-than symbol in HTML or XML, using the literal character can cause the browser to misinterpret markup. The safe approach is to escape the character as an HTML entity, especially in templates or user-generated content.
<p><</p> <!-- renders as a literal < symbol in the page -->If you’re building templates, confirm that the escaping is preserved during rendering to avoid broken markup or security issues. Using < consistently prevents browsers from treating the symbol as the start of an HTML tag. Shortcuts Lib notes that escaping is a best practice in environments where user input may be injected into HTML context.
Typing in code editors and IDEs
In code, the less-than symbol often appears inside strings, comparisons, and generics. The standard keyboard shortcut remains Shift + comma, but some editors offer snippets or language-specific shortcuts to insert special characters quickly.
// JavaScript example: a string containing a less-than symbol
const cmp = '<';
console.log(cmp); // outputs: <# Python snippet: comparing values with a literal '<'
if a < b:
print('a is less than b')Keep in mind that some editors or shells may interpret the character differently when used in template literals or query builders, so verify escaping or quoting as needed. Shortcuts Lib emphasizes consistency across languages to minimize errors when typing '<'.
Keyboard layout considerations
Keyboard layouts vary around the world, and some layouts place the comma key in a slightly different position. If Shift + comma doesn’t produce '<' on your machine, check your layout mapping. Tools like xmodmap (Linux) or Keyboard settings in Windows/Mac can reveal the current mapping and allow you to adjust or create a custom shortcut.
# Linux example: inspect keycodes for comma and shift
xmodmap -pke | grep -i commaOn non-US layouts, you might see a different base key, which can alter your muscle memory. The practical takeaway is to map a stable entry method (Shift+comma on most layouts) and document any layout-specific differences in your personal shortcuts sheet. Shortcuts Lib highlights layout awareness as a core principle for reliable shortcuts.
Creating a personal shortcut sheet
Maintaining a quick-reference sheet for less-than symbol typing helps you stay consistent across contexts. You can store key variants, usage notes, and caveats in a lightweight format for easy recall.
shortcut:
name: less-than
keys: Shift+Comma (Windows/macOS)
alt_entry: Alt+60 (Windows, numeric keypad)
html_escape: <This cheat sheet aids memory and supports onboarding for new team members. Regularly review and update it when you switch editors or OS versions. Shortcuts Lib recommends keeping a minimal, search-friendly doc so you can locate your preferred method in seconds.
Troubleshooting common issues
If you find that Shift+Comma doesn’t yield '<' in a specific environment, try these checks:
- Verify the active keyboard layout is the intended one (Windows: Language & Region settings; macOS: Keyboard input sources).
- Confirm the key is not remapped by a custom shortcut or macro.
- Test in multiple programs to distinguish system-level mapping from app-level mappings.
# Quick test in Linux shell to ensure basic character works
printf '<' # outputs: <If the problem persists, restart the application or the OS to clear any temporary keybinding conflicts. Shortcuts Lib suggests documenting the exact failure mode to facilitate faster troubleshooting.
Quick validation in editors
To ensure the less-than symbol behaves correctly across editors and languages, perform a quick validation check in a small script or snippet.
# Validation: ensure string contains a literal '<'
s = '<'
print(s == '<') # outputs: True# Validation in a shell script
if [ "<" = "<" ]; then echo 'ok'; fi # outputs: okThese checks confirm that the chosen shortcut reliably inserts the character without unintended escaping or interpretation in your current environment.
Steps
Estimated time: 15-30 minutes
- 1
Identify your layout
Check your current keyboard layout in system settings to confirm what key produces ',' and whether Shift changes it to '<'. This is the foundation for reliable shortcuts.
Tip: Use a layout diagram or a quick key-test in a text editor to confirm. - 2
Test the basic shortcut
Open a neutral text editor and press Shift + comma. Verify that a '<' appears. If not, switch to a US layout or adjust mappings.
Tip: Perform this test in multiple programs to ensure consistency. - 3
Try ASCII entry if needed
If Shift+Comma fails in constrained environments, attempt ASCII entry using Alt+60 (Windows) with the numeric keypad.
Tip: Ensure Num Lock is enabled for Alt codes. - 4
Experiment with Unicode input
On platforms that support Unicode input, try entering the code point for '<' and verify the result in your editor.
Tip: Some editors require specific Unicode input methods. - 5
Document your findings
Add the confirmed method to your personal shortcuts sheet and share it with teammates to reduce friction.
Tip: Keep it simple and searchable. - 6
Validate in HTML and code
In HTML templates and code blocks, confirm that escaping is correct (use < where needed).
Tip: Test both rendered output and source code views.
Prerequisites
Required
- A keyboard with a comma key (standard US layout)Required
- Windows or macOS systemRequired
- Basic familiarity with keyboard shortcutsRequired
Optional
- Optional: numeric keypad for Alt+60 entry on WindowsOptional
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Type the basic less-than symbolStandard US keyboard layout | ⇧+, |
| Enter through ASCII/Alt code (Windows)Requires numeric keypad; not available on all laptops | Alt+60 (numpad) |
| Escape HTML rendering by using entitiesPrefer < in HTML templates | ⇧+, (then type) |
Questions & Answers
What is the most universal way to type the less-than symbol on both Windows and macOS?
The standard method is Shift + comma. This works on most US layouts across Windows and macOS. For alternative entry, Windows users can use Alt+60 with the numeric keypad. HTML contexts commonly use < to render the symbol safely.
Shift+comma is the universal method on Windows and macOS; Alt+60 is an optional Windows method if you have a numeric keypad.
Can I type '<' in HTML without escaping it?
In HTML, the literal '<' starts a tag and can cause parsing issues. Use < to display the character safely in text content or inside attributes.
In HTML, you should escape it as < to avoid creating a real tag.
Does the shortcut differ on non-US keyboard layouts?
Yes. Some layouts place the comma key differently. If Shift+Comma doesn’t produce '<', check your layout mapping in system settings and adjust or remap as needed.
Layouts vary; check your keyboard mapping if you don’t get '<' with Shift+Comma.
Is Alt+60 universal across all Windows machines?
Alt+60 relies on the numeric keypad and may not work on all devices, especially laptops without a numpad. Use the standard Shift+Comma method where possible.
Alt+60 isn’t universal—use it only if your keyboard supports a numeric keypad.
Why is escaping important when typing '<' in code?
Escaping prevents the symbol from being treated as markup or control characters. Use literal '<' in strings and < in HTML to ensure correct rendering and interpretation.
Escape rules matter to keep code valid and predictable.
Main Points
- Shift+Comma types '<' quickly
- Alt+60 provides ASCII entry on Windows
- Use < in HTML/templates to render safely
- Test across editors to account for layout differences