How do I convert specific humidity to relative humidity?
Relative humidity is just $e/e_s$, the ratio of the vapor pressure to saturation vapor pressure or or $w/w_s$, the ratio of mass mixing ratios of water vapor at actual and saturation values.  If you have specific humidity, which is the mass mixing ratio of water vapor in air, defined as:

$$ q \equiv \dfrac{m_v}{m_v + m_d} = \dfrac{w}{w+1} \approx w.$$

Relative humidity can be expressed as the ratio of water vapor mixing ratio to saturation water vapor mixing ratio, $w/w_s$, where:

$$ w_s \equiv \dfrac{m_{vs}}{m_d} = \dfrac{e_s R_d}{R_v(p-e_s)} \approx 0.622\dfrac{e_s}{p},$$ 

and from Clausius-Clapeyron:

$$ e_s(T) = e_{s0}\exp\left[\left(\dfrac{L_v(T)}{R_v}\right)\left(\dfrac{1}{T_0} -\dfrac{1}{T} \right)\right] \approx 611\exp\left(\dfrac{17.67(T-T_0)}{T-29.65}\right).$$

Once you have calculated $w$ and $w_s$ you can obtain the relative humidity as:

$$ RH = 100\dfrac{w}{w_s} \approx 0.263pq\left[\exp\left(\dfrac{17.67(T-T_0)}{T-29.65}\right)\right]^{-1}. $$

You could also calculate $RH = 100(e/e_s)$, but I think since you are starting with $q$ it isn't as straightforward as doing it this way.



Variables used:

$q$ specific humidity or the mass mixing ratio of water vapor to total air (dimensionless)
$m_v$ specific mass of water vapor (kg)
$m_{vs}$ specific mass of water vapor at equilibrium (kg)
$m_d$ specific mass of dry air (kg)
$w$ mass mixing ratio of water vapor to dry air (dimensionless)
$w_s$ mass mixing ratio of water vapor to dry air at equilibrium (dimensionless)
$e_s(T)$ saturation vapor pressure (Pa)
$e_{s0}$ saturation vapor pressure at $T_0$ (Pa)
$R_d$ specific gas constant for dry air (J kg$^{-1}$ K$^{-1}$)
$R_v$ specific gas constant for water vapor (J kg$^{-1}$ K$^{-1}$)
$p$ pressure (Pa)
$L_v(T)$ specific enthalpy of vaporization (J kg$^{-1}$)
$T$ temperature (K)
$T_0$ reference temperature (typically 273.16 K) (K)