The use of appropriate keyboards clearly improves the typing activity, making the task faster and the workstation more comfortable. On the contrary, intensive use of inappropriate/unergonomic keyboards may lead to musculoskeletal injuries. During the last years the design of optimal keyboards as appeared as an interesting problem from UI design. The idea is to arrange the letters on a keyboard according to a given ergonomic criteria in order to maximize typing speed, and reduce fatigue as well as typing errors. In this paper, we focus on the letter assignment problem, whose goal is to minimize the cost of the keyboard which is computed according to the Fitts law and the movement time among keys. In particular, we employ particle swarm optimization (PSO), which is one of the pioneers metaheuristics that has been largely used to solve different problems from multiple application domains.