Skip to content
helps shorten units for
Branch: master
Clone or download
Latest commit a4eb396 Apr 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src More robust cli Apr 10, 2019
.gitignore Use puppeteer to generate unit ratios (#5) Apr 10, 2019
LICENSE Initial commit Apr 8, 2019 readme nits Apr 10, 2019
yarn.lock More robust cli Apr 10, 2019

Helps shorten units for


yarn global add unit-golf || npm install --global unit-golf


$ unit-golf [VALUE_TO_CONVERT]

Where VALUE_TO_CONVERT is any whole or fractional number of the following units:

px, vw, vh, in, cm, mm, pt, pc, em, ex, q, ch

If the unit is ommitted (eg, unit-golf 325) it will default to pixels.



Maximum difference in pixels that will be considered a match for a value. Defaults to 0.5. Decreasing will yield more exact but less concise results and vice versa.


Viewport width for the purpose of calculating vw units. Defaults to 400, which is what cssbattle currently uses.


Viewport height for the purpose of calculating vh units. Defaults to 300, which is what cssbattle currently uses.


$ unit-golf 57.3vw

⛳  32ex (-0.19px)

172pt (+0.14px)
229px (-0.19px)
57.3vw (+0.01px)
76.4vh (+0.01px)
242.6q (+0.03px)
6.06cm (-0.15px)
60.6mm (-0.15px)
28.65ch (+0.01px)
14.32pc (-0.07px)
14.32em (-0.07px)
2.39in (+0.25px)
$ unit-golf 57.3vw --tolerance 0

⛳  242.57q


Parens indicate how many pixels off each suggestion is from the target.

You can’t perform that action at this time.