Skip to main content
A standard 4x4 keypad. Great for numeric input, e.g. security pin code.

Pin names

Row
Row 1 (top row)
Row
Row 2
Row
Row 3
Row
Row 4 (bottom row)
Column
Column 1 (left)
Column
Column 2
Column
Column 3
Column
Column 4 (right)

Attributes

string
default:"4"
Number of columns: “3” or “4”
array
Labels for the keys
You can change the key labels as you like. The first four items in the array set the labels for the first row of keys, the next four items set the labels for the second row of keys, etc. Unicode characters are supported, so you can use special characters, accented letters, superscript/subscript (e.g. Xⁿ or A₁), and even emojis.

Arduino code example

The example below uses the Keypad library for Arduino. The key names set in the keys array define the values that keypad.getKey() returns. They don’t have to match the actual key labels (but it can be confusing if they don’t), and they must contain exactly one ASCII character.
You can also try this example on Wokwi.
You can use keyboard shortcuts to activate the buttons on the keypad. Click on the keypad once (now the keypad is in focus), and you can press 0…9/A/B/C/D/#/* in the keyboard to activate the corresponding key.

Simulator examples