Free Online JavaScript KeyCode Tester & Keyboard Event Monitor

Instantly test and inspect JavaScript keyboard events in real-time. View key codes, key names, modifiers, and detailed event objects for web development.

Built by@Akhenaten

AI Generation Prompt

Technical Specification: JavaScript KeyCode & Event Inspector

Overview

A clean, professional, single-file utility tool that allows developers to debug and visualize JavaScript keyboard events. The app captures live input and presents key metadata in a structured, readable format.

Developer Constraints (CRITICAL)

  • Single File: Everything must be contained in one HTML file (Tailwind CSS via CDN, Vanilla JS).
  • Sandboxed Iframe Friendly: ABSOLUTELY NO localStorage, sessionStorage, cookies, or IndexedDB. All state must be managed in-memory.
  • No Popups: Do not use alert() or prompt(). Use hidden DOM elements or custom modal overlays.
  • Light Mode Only: Strict usage of clean, light-mode color palettes (whites, light grays, vibrant primary blues/indigos).

Key Features

  • Real-time Event Capture: Listen for keydown, keyup, and keypress events globally.
  • Detailed Property Breakdown: Display the following properties for every event:
    • key
    • code
    • keyCode
    • which
    • location
    • altKey, ctrlKey, metaKey, shiftKey
  • History Log: A scrollable list of recent events to compare sequences.
  • Visual Key Representation: A dynamic virtual keyboard display that highlights the pressed key.
  • Quick Copy: Ability to copy individual event properties to the clipboard.
  • Clear Log: A single button to flush current history.

UI/UX Layout

  1. Header: Minimalist title area with a clear instruction ("Press any key to get the JavaScript event key code").
  2. Main Display Area: A large, centered "Primary Key Display" card showing the currently pressed key and code in large, bold typography.
  3. Event Table: A list view below the main display containing the last 20 events. Columns: Event Type, Key, Code, KeyCode.
  4. Sidebar/Panel: A control panel for toggling specific event listener types (keydown vs keyup).

Aesthetic Guidelines

  • Palette:
    • Background: bg-slate-50
    • Cards: bg-white with shadow-md and border-slate-200
    • Typography: text-slate-800 (headings), text-slate-600 (body)
    • Accent: bg-indigo-600 (buttons), text-indigo-600 (highlights)
  • Animations:
    • Smooth fade-in for new history items (CSS transition: opacity 0.2s ease-in-out).
    • Gentle scale-up transform for the large key display on press.

Technical Implementation Strategy

  • JavaScript: Use window.addEventListener('keydown', ...) and window.addEventListener('keyup', ...).
  • State Management: Maintain an array of objects eventHistory = [] and currentKey = {}.
  • Responsiveness: Use CSS Grid and Flexbox to ensure the History table collapses gracefully on mobile devices, possibly switching to a vertical stacked card view on screens < 768px.
  • Performance: Use document.createDocumentFragment() or clear/re-render logic to keep the DOM clean when updating the history table.

Spread the word

8Total Views
gemini-3.0-flashAI Model

Files being used

index.html
29.5 KB
#javascript keycode tester#online keyboard event inspector#web development keyboard tool#js keypress event monitor#browser key event debugger#free online keyboard tester#javascript keydown event viewer

Frequently Asked Questions

Everything you need to know about using this application.

What is a JavaScript KeyCode Tester used for?

It helps web developers identify specific key codes (like key, code, keyCode, and which) triggered when pressing keys, which is essential for creating keyboard shortcuts, game controls, or form interactions.

Does this tool store my keyboard history?

No. This application runs entirely in your browser's volatile memory. No data is stored, saved, or transmitted to any server.

Can this tool detect all keyboard events?

Yes, it captures keydown, keypress, and keyup events in real-time, displaying the comprehensive event object for each interaction.

Related Applications