Overview
Introduction
Long before USB HID reports, PS/2 keyboards communicated every keypress as a scan code, a single hex byte identifying the physical key, using a standard layout still referenced constantly in low-level OS development and embedded firmware work.
This tool converts ASCII text into the sequence of PS/2 Set 1 make-scan-codes a US QWERTY keyboard would send to type it, including the real shift-prefix convention for uppercase letters and shifted symbols.
What Is ASCII to Scan Codes Converter?
A text-to-scan-code encoder built on the classic PS/2 Set 1 make-code table (the same table used by the original IBM XT/AT keyboard controller and still emulated by virtually every PC-compatible keyboard today).
It distinguishes base (unshifted) keys from shift-required characters: a lowercase letter or digit is one scan code byte, while an uppercase letter or shifted symbol is the Left-Shift make code (2A) followed by the base key's byte.
How ASCII to Scan Codes Converter Works
The input is validated as strict 7-bit ASCII, then each character is checked against the base scan-code table (letters, digits, space, and common punctuation) or, for uppercase letters and shifted symbols, resolved to its unshifted base key first.
Shift-required characters are prefixed with the Left-Shift make code 2A before the base key's byte; characters with no reasonable physical key on a standard layout are rejected with an error naming the character and position.
When To Use ASCII to Scan Codes Converter
Use it when working with low-level keyboard driver code, OS development tutorials, or embedded firmware that processes raw PS/2 scan codes directly.
It's also useful for generating test input sequences for a keyboard controller emulator or for understanding exactly what bytes a real keyboard sends for a given string.
Often used alongside Scan Codes to ASCII Converter, ASCII to Keycodes Converter and ASCII to Hex Converter.
Features
Advantages
- Implements the real, standard PS/2 Set 1 make-code table rather than an invented scheme.
- Correctly represents shift-required characters using the genuine two-byte shift-prefix convention real keyboards use.
- Reports precisely which character and position triggered a rejection when no reasonable physical key exists.
Limitations
- Only generates make codes (key-down); it doesn't model break codes (key-up) or the timing/ordering of a real key-press sequence.
- Covers letters, digits, space, and common punctuation only; function keys, arrow keys, and other non-printable keys aren't in scope since there's no ASCII character to drive them from.
Examples
Best Practices & Notes
Best Practices
- Remember scan codes model physical keys, not characters, so a mixed-case round trip through this tool and its decoder preserves case correctly, unlike keyCode-based tools.
- If you need break codes too, add 0x80 to each base byte in the output yourself; this tool intentionally only models the make (press) sequence.
Developer Notes
The base table is a fixed array of [character, hex] pairs taken from the standard PS/2 Set 1 make-code layout (letters/digits/punctuation in their conventional row order). Shifted characters are resolved through a SHIFTED_SYMBOL_TO_BASE lookup (e.g. "!" -> "1") before the base lookup, then prefixed with the literal Left-Shift code "2A"; scan-codes-to-ascii-converter imports this same table and inverts it so both tools share one source of truth.
ASCII to Scan Codes Converter Use Cases
- Generating test input for a PS/2 keyboard controller emulator or OS-development keyboard driver
- Understanding exactly which bytes a physical keyboard sends for a given string, shift prefix included
- Cross-referencing scan-code values while following a low-level keyboard-driver tutorial
Common Mistakes
- Assuming a scan code changes based on Shift state; it doesn't, the base key's code is constant, Shift state is communicated by a separate Left-Shift make/break code.
- Forgetting the Left-Shift prefix is a real, separate byte in the sequence, not an attribute encoded into the following byte.
Tips
- Round-trip through Scan Codes to ASCII Converter to confirm mixed-case text and shifted symbols decode back exactly, since this format (unlike keyCode) does preserve case.
- The Left-Shift make code 2A is always literally "2A" in the output; look for it to spot every shift-required character at a glance.