A code which generates the camber shape of a sail from a desired sail plan-form, sail twist distribution and surface pressure map has been written. This is an iterative 3D inverse sail design code. The method initially uses inverse thin aerofoil theory, applies this to the desired pressure map and creates an initial sail shape. A theory which gives a relationship between the change in the pressure map and the change in the sail camber was developed and is described. The code applies that theory to the difference between the desired pressure map and the pressure map of the initial sail shape. The calculated camber difference is added to the initial shape to give an improved shape with a pressure distribution closer to the desired one. This process is repeated until the generated sail produces the desired pressure map. Validation tests were performed by generating a pressure distribution from a known sail shape using a VLM code, and then the method described in the paper was used to find the shape from the pressure distribution. The sail shape was successfully obtained in as few as five iterations, with a maximum error of only about 0.2 % of the sail chord, which is acceptable in sail design practice.