Determining the optimum type and location of new wells is an essential component in the efficient development of oil and gas fields. The optimization problem is, however, demanding due to the potentially high dimension of the search space and the computational requirements associated with function evaluations, which, in this case, entail full reservoir simulations. In this paper, the particle swarm optimization (PSO) algorithm is applied for the determination of optimal well type and location. The PSO algorithm is a stochastic procedure that uses a population of solutions, called particles, which move in the search space. Particle positions are updated iteratively according to particle fitness (objective function value) and position relative to other particles. The general PSO procedure is first discussed, and then the particular variant implemented for well optimization is described. Four example cases are considered. These involve vertical, deviated, and dual-lateral wells and optimization over single and multiple reservoir realizations. For each case, both the PSO algorithm and the widely used genetic algorithm (GA) are applied to maximize net present value. Multiple runs of both algorithms are performed and the results are averaged in order to achieve meaningful comparisons. It is shown that, on average, PSO outperforms GA in all cases considered, though the relative advantages of PSO vary from case to case. Taken in total, these findings are very promising and demonstrate the applicability of PSO for this challenging problem.