How to convert density from physical unit to comoving unit? I am learning co-moving units and I am interested to see how the conversion works. If Hubble constant is assumed to be 0.7, then I want to convert $1gm/cm^3$ into comoving unit. If I want to express length in co-moving kilo-parsec per hubble constant (${\rm ckpc}/{\rm h}$), instead of cm, then how does the conversion happen?
You're asking two different, but somewhat related questions: One has to do with a practical way of describing the expansion of the Universe; the other has to do with a way of dealing with our ignorance of the exact expansion rate of the Universe.
I will answer your specific question in the last paragraph.
Comoving and physical coordinates
A comoving coordinate system is one in which particles that don't move through space have fixed coordinates, even is that space is expanding (or contracting, or otherwise warping).
In contrast, the particles' physical coordinates are the actual distances you would measure between them if you froze space and started laying out measuring rods.
Expansion, scale factor, and redshift
Cosmological distances are often measured in megaparsec (Mpc), i.e. one million parsec, or roughly 3.3 million lightyears.
Our Universe expands, and we describe this expansion not by its size (because we don't know how large it is, or even if its finite), but by a scale factor $a$, which is defined to be equal to $1$ today. Thus, in the past, when everything was half the distance from each other compared to today, we had $a=0.5$. Because light moving through an expanding space is redshifted, light from a certain time when $a$ had a certain value, is redshifted (&quot;stretched&quot;) by a certain factor. It turns out that if we observe some light to have been redshifted by a particular value of $z$, it must have been emitted at a time when the scale factor was $a = 1/(1+z)$.
Definition of comoving coordinates
Comoving coordinates are defined to coincide with the physical coordinates today. That is, if the physical distance to galaxy &quot;CLASH 2882&quot; is 3.4 Gpc, so is the comoving distance, always was, and always will be (save for a very small movement through space, but this can be neglected). The light we receive from CLASH 2882 is redshifted to twice its emitted wavelength, so $z=1$, and $a=1/(1+1)=0.5$. At earlier times, when $a$ was, say, $0.75$, $0.5$, and $0.1$, the physical distance to CLASH 2882 was 2.5 Gpc, 1.7 Gpc, and 340 Mpc, but its comoving distance was always 3.3 Gpc.
In other word, a comoving meter is only equal to a real, physical meter today, but was smaller in the past and will be larger in the future. To be explicit, we sometimes prepend a unit with a &quot;c&quot; or a &quot;p&quot;, like this:
$$
1\,\mathrm{pMpc} \equiv \frac{1\,\mathrm{cMpc}}{1+z}.
$$
The use of comoving coordinates
Comoving coordinates are practical for instance when comparing properties of something that may or may not evolve with time, but also change with the size of space, e.g. densities. One example is the number density of galaxies. If galaxies had just been around forever, without evolving, then their number density would decrease with time proportionally to $1/a^3$. To study how galaxies form, evolve, merge, etc. it is helpful to factor this out, i.e. to use comoving coordinates. If the number density in comoving coordinates change, it must be due to some &quot;real&quot;, astrophysical effect, not just because of cosmological expansion.
Another example is the density of neutral hydrogen, in $\mathrm{g}\,\mathrm{cm}^{-1}$. In physical units, if nothing happened this density would decrease as $1/a^3$, whereas in comoving units it would be constant. Nevertheless, when $a$ was about $0.1$ the global, comoving density dropped several orders of magnitudes, evident of a physically significant process referred to as the Epoch of Reionization.
Converting between physical and comoving units
So, if you want to convert between physical and comoving units, just remember that the comoving coordinates factor out the expansion of the Universe, and you have, for distances,
$$
d_\mathrm{physical} = a d_\mathrm{comoving} = \frac{d_\mathrm{comoving}}{1+z},
$$
and consequently, for densities,
$$
n_\mathrm{physical} = a^{-3} n_\mathrm{comoving} = n_\mathrm{comoving}(1+z)^3,
$$
Little $h$
The little $h$ commonly seen in length units (and units derived hereof) is a way of factoring out the exact magnitude of the expansion rate $H_0$ of the Universe. It is defined by
$$
H_0 = 100h\,\mathrm{km}\,\mathrm{s}^{-1}\,\mathrm{Mpc}^{-1}.
$$
That is, if $H_0=70\,\mathrm{km}\,\mathrm{s}^{-1}\,\mathrm{Mpc}^{-1}$, then $h=0.7$, and if $H_0=67.81\,\mathrm{km}\,\mathrm{s}^{-1}\,\mathrm{Mpc}^{-1}$, then $h=0.6781$. The use of $h$ is something of a reminiscence from the times when we only knew that $H_0$ was of the order of $50$–$100\,\mathrm{km}\,\mathrm{s}^{-1}\,\mathrm{Mpc}^{-1}$, and factoring out the exact value allowed people assuming different values to more easily compare their results. It may be argued — and has in fact been (Croton 2013) — that today, where $H_0$ is known rather precisely to be around $70\,\mathrm{km}\,\mathrm{s}^{-1}\,\mathrm{Mpc}^{-1}$, $h$ only acts to confuse. It does, however, seem to prevail, especially in numerical, cosmological simulations.
$h$ notation
The way you express your question, namely that you

want to express length in co-moving kilo-parsec per hubble constant

shows, in my opinion, a common misinterpretation of the use of $h$: The factor $h$ is not a part of the unit of some number; rather it should just be thought of as a number that is multiplied on the quantity. So, although the result is the same, I think it's better to write, say,
$$
d = 2300h^{-1}\,\mathrm{Mpc}
$$
than
$$
d = 2300\,\mathrm{Mpc}/h.
$$
$h$ in quantities
$h$ appears whenever a derived quantity depends on $H_0$. Because some quantities can be derived in different ways, you may actually encounter the same quantity multiplied by different powers of $h$, depending on how it was derived. For instance, deriving a galaxy's mass from its luminosity introduces two factors of $H_0$, so if its &quot;true&quot; (stellar) mass was, say, $M_\star=10^{10}\,M_\odot$,
then if you had assumed $h=0.7$ you'd write
$M_\star=4.9\times10^9h^{-2}\,M_\odot$.
But if the same galaxy's mass was derived from dynamics, you'd only have one factor of $H_0$, so you'd write
$M_\star=7\times10^9h^{-1}\,M_\odot$.
Converting to &quot;$h$-units&quot;
In general, to convert a number to &quot;$h$-units&quot; (bearing in mind that $h$ is not a part of the unit), you need to know how it was calculated. Derived distances, for example, usually scale inversely with $H_0$ (to the power of one), so it makes sense to measure in $h^{-1}\,\mathrm{Mpc}$, that is to divide the quantity by $h$. Thus, assuming $67.8\,\mathrm{km}\,\mathrm{s}^{-1}\,\mathrm{Mpc}^{-1}$ we may write the distance to CLASH 2882 as
$$
\begin{array}{rcl}
d &amp; = &amp; 3.3\,\mathrm{Gpc}\\
  &amp; = &amp; 2.3h^{-1}\,\mathrm{Gpc}.
\end{array}
$$
On the other hand, since derived times scale proportionally to $H_0$, they may be measured, e.g., in $h\,\mathrm{years}$ and thus, in velocities these two $h$ factors cancel, such that velocities are just measured in, say, $\mathrm{km}\,\mathrm{s}^{-1}$.
The answer to your question
We are now ready to answer your specific question of converting from cm to comoving kpc with $h$ factored out.
You need to know two things: The assumed value of $H_0$, and the redshift of the object you're considering. For the sake of this calculation, let's assume that $h=0.7$ and $z=0.1$, and that we want to write the diameter of a galaxy whose physical diameter is, say, $10^{23}\,\mathrm{cm}$ (a Milky Way-sized galaxy). Then
$$
\begin{array}{rcl}
R_\mathrm{phys.} &amp; = &amp; 10^{23}\,\mathrm{cm}\\
                 &amp; = &amp; \frac{3\times10^{-22}\,\mathrm{kpc}}{\mathrm{cm}} 10^{23}\,\mathrm{cm}\\
                 &amp; = &amp; 32.4\,\mathrm{kpc}\\
                 &amp; = &amp; 32.4 \times h \, \times \, h^{-1}\,\mathrm{kpc}\\
                 &amp; = &amp; 22.7 h^{-1}\,\mathrm{kpc}.
\end{array}
$$
and
$$
\begin{array}{rcl}
R_\mathrm{com.} &amp; = &amp; (1+z) \, R_\mathrm{phys.}\\
                &amp; = &amp; (1+0.1) \, 22.7\, h^{-1}\,\mathrm{kpc}\\
                &amp; = &amp; 25 h^{-1}\,\mathrm{kpc}.
\end{array}
$$
Similarly, a density of $n_\mathrm{phys.}=1\,\mathrm{g}\,\mathrm{cm}^{-3}$ could be expressed as$^\dagger$ $n_\mathrm{com.}=3.9 h^3\,\mathrm{g}\,\mathrm{cm}^{-3}$.

$^\dagger$ Note however, that if instead of particles per cubic centimeter you were to measure Solar masses per cubic Mpc, then depending on how you had measured the mass, there could be up to two factors of $h$ canceling some of the $h^{-1}$ in this expression.