Scan Codes to ASCII Converter

Decodes space-separated PS/2 Set 1 keyboard make-scan-code hex bytes back into ASCII text, correctly handling the Left-Shift make code (2A) prefix convention that real keyboards use to signal a shifted character. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

A dump of raw PS/2 scan codes from a keyboard controller trace or an OS-development debugging session is unreadable without a lookup table and, crucially, without correctly handling the shift-prefix byte sequence.

This tool decodes a space-separated sequence of PS/2 Set 1 make-scan-code hex bytes back into readable ASCII text, correctly resolving the Left-Shift make code (2A) prefix into the right shifted character.

What Is Scan Codes to ASCII Converter?

A reverse lookup for PS/2 Set 1 keyboard make-scan-codes: given a sequence of hex bytes, it reconstructs the text a US QWERTY keyboard was typing.

It specifically understands the two-byte shift convention, so "2A 23" decodes to the single character "H" rather than two separate, meaningless outputs.

How Scan Codes to ASCII Converter Works

The input is split into 2-digit hex tokens; whenever a token equals the Left-Shift make code "2A", the following token is looked up as a shifted key instead of a base key, and both tokens together produce one output character.

Any other token is looked up directly in the base scan-code table; a dangling shift prefix with nothing after it, or any code not in the table, is rejected with a specific error.

When To Use Scan Codes to ASCII Converter

Use it to read raw PS/2 scan-code traces from a keyboard controller, OS-development debugging session, or embedded firmware log.

It's also the fastest way to verify an ASCII to Scan Codes Converter round trip, since this format preserves case correctly, unlike the keyCode-based tools.

Features

Advantages

  • Correctly implements the real shift-prefix convention instead of treating each byte in isolation.
  • Recovers exact original case and shifted symbols, something the keyCode-based decoder in this category can't do.
  • Gives a specific, positioned error for a dangling shift prefix or an unrecognized code.

Limitations

  • Only decodes make (key-down) codes; it has no concept of break codes (key-up, base code + 0x80) since it models a single "what character was typed" sequence.
  • Only covers the letters, digits, space, and common punctuation in the base table; function keys, arrow keys, and similar non-character keys aren't represented.

Examples

Decoding lowercase base codes

Input

23 17

Output

hi

Both codes are looked up directly in the base table with no shift prefix involved.

Decoding a shift-prefixed letter

Input

2A 23 17

Output

Hi

"2A 23" together decode to the single uppercase character "H"; "17" then decodes normally to "i".

Rejecting a dangling shift prefix

Input

23 2A

Output

Error: shift prefix "2A" at position 2 has no following scan code.

A shift prefix at the very end of the input has no key code to modify, so it can't be decoded into a character.

Best Practices & Notes

Best Practices

  • If you're unsure whether a trace includes break codes, strip any byte with the high bit set (0x80 or above) before decoding, since this tool only expects make codes.
  • Use this alongside ASCII to Scan Codes Converter when you want to confirm a specific string encodes and decodes back exactly.

Developer Notes

Imports the same BASE_SCAN_CODES array and SHIFTED_SYMBOL_TO_BASE table ascii-to-scan-codes-converter defines, inverts BASE_SCAN_CODES into a hex-to-character map, and derives a base-to-shifted-symbol map from the inverse of SHIFTED_SYMBOL_TO_BASE, so both tools share one hand-maintained source of truth for the PS/2 Set 1 layout.

Scan Codes to ASCII Converter Use Cases

  • Reading a raw PS/2 scan-code capture from a keyboard controller or OS-development debugging session
  • Verifying that a keyboard emulator or firmware driver produces the expected scan-code sequence for known text
  • Teaching how the shift-prefix convention lets a byte-oriented protocol still communicate shifted characters

Common Mistakes

  • Feeding in break codes (make code + 0x80) expecting them to decode the same way; this tool only recognizes make codes.
  • Treating "2A" as a character to render on its own; it's a prefix that modifies the reading of the code right after it, not a standalone output.

Tips

  • Every scan code in the output is exactly 2 hex digits; if a token doesn't match that shape, that's the first thing to check for a transcription error.
  • Look for "2A" pairs in your input to quickly spot which characters in the decoded output came from a shifted key.

References

Frequently Asked Questions