All Tools View Categories About Contact Privacy

Convert ASCII to Keycodes

Convert ASCII characters to legacy keyCodes.

Your input is processed locally in the browser.

Output is keyCodes as decimal numbers.

About Convert ASCII to Keycodes

Convert ASCII to Keycodes Map ASCII characters to the common legacy DOM KeyboardEvent keyCode values used by a US keyboard.

This can be useful when reading older browser code, debugging historical key event data, or comparing printable characters with legacy JavaScript keyCode tables.

Start with the built-in sample, then replace it with a short test value that makes the rule obvious. Small examples are easier to verify because you can count the characters, positions, or numeric codes by hand before using longer input.

keyCode is deprecated and is not a physical scan code or a USB HID Usage ID. The mapping here is intentionally labeled as a legacy US keyboard reference so it is not mistaken for a universal hardware-code standard.

Use simple letters, digits, and punctuation first, then compare the result with the legacy keyCode reference expected by the application.

Do not use these values as a modern keyboard API contract. For new browser code, use KeyboardEvent.key, code, or other current event properties instead. The transformation happens locally in the browser, so there is no upload step or external conversion service.

Features

  • Uses a defined legacy US keyboard keyCode mapping.
  • Supports letters and digits.
  • Includes common punctuation.
  • Makes the mapping scope explicit.
  • Rejects unsupported symbols.
  • Runs locally.
  • Includes sample.
  • Supports copy/download.
  • Preserves character order.
  • Not presented as scan codes or HID IDs.

How to Use

  1. Load sample.
  2. Convert.
  3. Inspect each keyCode.
  4. Check punctuation carefully.
  5. Copy/download.
  6. Use modern KeyboardEvent APIs for new software.

Examples

A. 65.

a. 65 in the legacy keyCode mapping.

1. 49.

Space. 32.

!. Common legacy mappings depend on the key position and modifier behavior; this tool stays limited to the defined printable map.

Benefits

  • Useful for legacy JavaScript debugging.
  • Explicit scope reduces confusion.
  • Deterministic mapping.
  • Local.
  • Easy to inspect.
  • Good for historical code.
  • Copyable output.

Frequently Asked Questions

Is keyCode current?
No, it is deprecated.
Is this a scan code?
No.
Is this USB HID?
No.
Which keyboard layout?
US-oriented legacy mapping.
Does lowercase have a different keyCode?
Legacy keyCode generally reports the same key code as the corresponding uppercase letter.
Can I use Unicode?
No.
Can I copy?
Yes.
Can I download?
Yes.
Should new code use keyCode?
No; modern KeyboardEvent properties are preferred.
Does input upload?
No.