Define the convention for the spherical coordinates you will use. There is no overarching standard, but physicists often define the angle theta measured down from the positive z axis and the angle phi as measured from the positive x-axis towards the y-axis in the x-y plane. R is the distance from the origin.
Identify the cartesian coordinates to transform. That is, find a point represented by x, y, and z values that you wish to represent in spherical coordinates. The general transformations will work for all values of x, y, and z.
As an example, take x = 3, y = 7, z = 4.
Calculate R.
R = square root ( x^2 + y^2 + z^2 ).
For the example, R = square root (9 + 49 + 16) = square root (74) = 8.6
Calculate theta.
Theta = arcsin (square root( ( x^2 + y^2 ) / ( x^2 + y^2 +z^2 ) ).
Arcsin is the inverse sine function, found on all scientific or mathematical calculators.
Continuing the example,
theta = arcsin (square root ((49 + 9) / (9 + 49 + 16))
theta = arcsin (square root (0.784)) = arcsin (0.885)
theta = 62.3 degrees.
Calculate phi.
Phi = arctan ( y / x ).
Finishing the example, phi = arctan ( 7 / 3 ) = 66.8 degrees.