We start with a given line segment AB> This will become one side of the square.


Note. Steps 1 through 5 construct a perpendicular to line AB at the point B.
This is the same construction as
Constructing the perpendicular at a point on a line 
1. Extend the line AB to the right. 

2. Set the compasses on B and any convenient width. Scribe an arc on each side of B,
creating the two points F and G. 

3. With the compasses on G and any convenient width, draw an arc above the point B.


4. Without changing the compasses' width, place the compasses on F and draw an arc above B, crossing the previous arc, and creating point H 

5. Draw a line from B through H.
This line is perpendicular to AB, so the angle ABH is a right angle (90°);
This will become the second side of the square


We now create four sides of the square the same length as AB 
6. Set the compasses on A and set its width to AB.
This width will be held unchanged as we create the square's other three sides. 

7. Draw an arc above point A. 

8. Without changing the width, move the compasses to point B.
Draw an arc across BH creating point C  a vertex of the square. 

9. Without changing the width, move the compasses to C.
Draw an arc to the left of C across the exiting arc, creating point D  a vertex of the square. 

10. Draw the lines CD and AD 

Done. ABCD is a square where each side has a length AB 