• Skip to content
  • Skip to primary sidebar
  • Skip to footer

Foliovision

Main navigation

  • Weblog
    • FV Player
    • WordPress
    • Video of the Week
    • Case Studies
    • Business
  • About
    • Testimonials
    • Meet the Team
    • We Support
    • Careers
    • Contact
    • Pricing
  • Products
  • Support
    • FV Player Docs
    • Pro Support
  • Login
  • Basket is empty
Affordable VAST/VPAID for Wordpress has arrived. Serve ads with your videos starting today!

WordPress Responsive Design Calculator: Pixels to REM

8 March 2013 / viktor / 36 Comments

We are really busy here at Foliovision, designing and launching a few websites per week.

Most of our sites are custom designs built on top of existing themes. We really like the bundled WordPress theme TwentyTen. Recently we’ve started the move to responsive design and have started working with TwentyTwelve (Twenty Eleven was a bit of a dog, neither fish nor fowl).

Responsive design means calculating REM units. As a designer, my math is kind of crappy. Especially the doing it in the head kind. I don’t like to fill my head with figures when I’m working on making a site look good.

Calculating sizes means some extra work time, as all dimensions (widths, heights, margins, paddings, line-heights) have to be calculated double, one in pixels as a fallback option and one in REM. Plus you have 3 different screensizes set up in the CSS. That means 3 different calculations just for one element. Not to speak of the fact, that line-height has a different variable from the rest of the mesurements.

To make my (and yours easier), I asked the programmers here (thanks Peter) to build a simple calculator to convert pixels to REM units so we can get on with our lives.

Instructions

Just type the value in pixels and hit Enter. You will get two results – one to be used for font-size, width, height, margin, padding and the other result for line-height. There are two calculators, because TwentyTwelve is using 14px=1rem as the initial variable, but some other themes might be using 16px=1rem. Always check your theme first for initial font-size and pick the calculator that applies to you.

REM SIZE CALCULATOR (font-base 14 / line-height 24)

Rem
Line-height

REM SIZE CALCULATOR (font-base 16 / line-height 26)

Rem
Line-height

 

Tip: A single click then selects the whole result, after that you can copy and paste it to your CSS.

Please let us know if you have any ideas on how we can improve this. I hope it helps you as much as it helps me (and our other CSS designers).

Further thoughts on responsive design and specifically TwentyTwelve

After having the calculator in place, it gave us more freedom to explore the different nuances of responsive themes. So we started to play around. At the moment we can sum up our ideas in a few points, but more testing was already done and we will update the list soon.

  • There are situations, where the elements will jump all over the place. As said above, 3 different screensizes are covered in the CSS file. Especially when you are close to the border to the next screensize, some elements might slip.
  • You also have to remember, that it’s written in HTML5. Which means, fallbacks for IE7 and IE8 have to be in place.
  • You have to leave a significant portion of your CSS tricks behind, as these simply won’t work anymore. With a flexible theme you just cannot give the element a fix-sized wrapping div. Floats behave sometimes nasty too, when resizing a browser window.
  • Responsive themes might have some new limitations, so a close cooperation between designers (CSS and Photoshop) is a must. CSS designer must pick up the new scheme and communicate what is possible and what is not.
  • My impression so far is that TwentyTwelve is a great theme, but since it’s built mobile-first, content and structure would have to adjust to the theme, not the other way around. Let’s not forget this when tempted to bulk up the theme to a complex one.

Helpful Extract from TwentyTwelve style.css intro comments:

/* =Notes
--------------------------------------------------------------
This stylesheet uses rem values with a pixel fallback. The rem
values (and line heights) are calculated using two variables:

 

$rembase: 14;
$line-height: 24;

 

---------- Examples

* Use a pixel value with a rem fallback for font-size, padding, margins, etc.
padding: 5px 0;
padding: 0.357142857rem 0; (5 / $rembase)

* Set a font-size and then set a line-height based on the font-size
font-size: 16px
font-size: 1.142857143rem; (16 / $rembase)
line-height: 1.5; ($line-height / 16)

---------- Vertical spacing

Vertical spacing between most elements should use 24px or 48px
to maintain vertical rhythm:

.my-new-div {
margin: 24px 0;
margin: 1.714285714rem 0; ( 24 / $rembase )
}

Further reading

Font Sizing With REM
Type study: Sizing the legible letter

Viktor Klimo

Viktor Klimo

Viktor comes from Bratislava. During his university studies of Journalism and German language he moved to Nitra. After his studies he spent nearly 3 years in Sydney. Apart from fatherhood and design, he is passionate about food and coffee. He maintains one of the oldest Slovak foodblogs at delikatesy.sk.

Categories: Design, WordPress

Related Posts

  1. Approaching Responsive Design

    Approaching Responsive Design

  2. Foliopress WYSIWYG CSS for templates

    Foliopress WYSIWYG CSS for templates

  3. Tumblr to WordPress Migration Service

Reader Interactions

Comments

  1. Channy 29 May 2013 at 8:54 am

    Thanks for this post.

    Reply
  2. Pieter Goosen 30 May 2013 at 8:16 pm

    Thanks for the calculator, make my job so much easier

    Reply
  3. Georges 17 June 2013 at 5:18 pm

    Merci beaucoup ! cette page me sera bien utile …

    Reply
  4. Roberto Chahim - Brazil 3 July 2013 at 6:41 pm

    thanks!

    Reply
  5. Debanjan Paul 11 July 2013 at 9:27 am

    This px to rem calculator is really good… Thanks!!!

    Reply
  6. Flame Denise 16 July 2013 at 3:27 am

    You’re such a darling. this tiny calculator is really helpful. Thank you very much. ^_^

    Reply
  7. Thiago Fagundes 16 July 2013 at 8:04 am

    Awesome calculator, thank you! :-)

    Reply
  8. Larry 25 July 2013 at 6:10 am

    the calculator is great. Thanks alot.

    Reply
  9. Jay Khatri 5 August 2013 at 2:13 pm

    I never understood why and how to use em and rem. Anyways, you calculator is just release of pain.

    Reply
  10. Lin 26 August 2013 at 4:22 pm

    calculator does not work: 24px is 1.5rem not 1.71428571rem!!!

    Reply
  11. Louisa 1 October 2013 at 3:56 pm

    Thank you so much! That calculator has saved me loads of time :-D Someone left a comment saying it ‘does not work’ – to be honest, I don’t have time to check whether the calculations are spot on but I don’t care – it’s close enough for my purposes :)

    Reply
  12. Avatar photoAlec 2 October 2013 at 12:01 am

    Hi Louisa,

    Glad we could help. We use the calculator all the time. We’d be happy to update any issues that anyone finds.

    Share it with your friends and let us know if there’s anything else we could add for you.

    I wish you joy in your design and coding!

    Reply
  13. Seb Barraud 26 October 2013 at 5:57 pm

    Very usefull ! Thank you

    Reply
  14. paolo 5 November 2013 at 12:16 pm

    hi i’d like to know if this will also work on element sizes? or better to use percentage? thanks

    Reply
  15. Georgie 13 November 2013 at 4:35 am

    Hi

    I’m new to wordpress & this tool has been a dream! It’s my new number one bookmark.

    thanks again

    Reply
  16. Emily Capito 18 November 2013 at 8:02 pm

    So helpful! Thanks!

    Reply
  17. Dylan Archer 24 November 2013 at 5:06 pm

    I love tools like this and greatly appreciate the hard work put into bringing a tool to everyone like this; however, are these calculations accurate?

    e.g. I am use to 16px equating to 1rem/em, where as here it is equal to 1.143rem (rounded) that’s a fairly large adjustment and around a 2 pixel difference from what I am familiar with.

    Really, I just wonder if the calculations are basing itself on the font-family you’re using (seeing as em/rem is based on the width of the letter “M” for whichever font you’re using) OR if these are actually more accurate on a sub-pixel level OR if the calculations are off slightly?

    I’m no measurement unit guru, I’m just familiar with a different set of numbers than the ones being generated here, so don’t take this as an insult, more of a inquiry of curiosity.

    Reply
  18. Avatar photoAlec 29 November 2013 at 4:22 am

    Hi Dylan,

    There are some small discrepancies. We’ll work on improving the calculator again soon.

    Thanks for your notes.

    Reply
  19. viktor 29 November 2013 at 11:37 am

    Hi Dylan,

    the units are not dependent on fonts but on the initial font-size declaration. As the article states, but maybe wasn’t clear enough, the calculator is based on the TwentyTwelve theme. Which in this case means html { font-size: 87.5%; }

    If you have set this to a different size, the rest of the math will look just different. We probably won’t do adjustments to this calculator, as it would ruin the ease of use. Now it’s a minimum of keyboard shortcuts, to get the REM result copied to your clipboard. So additional options would just slow down the process.

    In the meantime we’ve moved to TwentyThirteen, which is not using REM units anymore. I’ll do an update to the post about that.

    thanks

    Reply
  20. Avatar photoAlec 1 December 2013 at 2:10 pm

    Actually Dylan, we will be releasing a version which allows you to change the starting point in REM, as well as a calculator for TwentyThirteen (based on pixels).

    Thanks for your question!

    Reply
  21. Dylan Archer 1 December 2013 at 6:21 pm

    Thanks for the update guys. That explains a lot. Keep up the great work!

    Reply
  22. Istvan HOLCZER 28 January 2014 at 7:27 pm

    Thank you very-very much!!!!!!

    Reply
  23. Peder B. Helland 3 May 2014 at 10:22 pm

    Fantastic! Thank you so much for this!

    Reply
  24. André 14 May 2014 at 4:10 pm

    Hi pal. Thank you for your calculator, I use it a lot. If would be great if at the bottom of the form the values were shown at the following text format:

    font-size: px font-size: rem; line-height: ;

    in order to be easy to copy past to my css.

    Thanks.

    Reply
  25. Pankaj Vagare 10 September 2014 at 11:29 am

    Thank you so much for this!

    Reply
  26. Robin Button 9 December 2014 at 7:39 pm

    I love this calculator, and use it all the time as I build my Twenty-Twelve child themes! Thank you so much!

    Reply
  27. Avatar photoAlec 12 December 2014 at 5:42 am

    Hi Robin,

    Thanks for your kind words. They are much appreciated!

    Have a wonderful holidays!

    Reply
  28. Marcin 14 January 2015 at 5:35 pm

    Awesome!! Can you share this as wp widget or xls file ? :)

    Reply
  29. Avatar photoAlec 16 January 2015 at 8:23 pm

    Hi Marcin,

    Thanks for writing.

    I think the calculator works just great here. And it saves us managing lots of updates.

    Enjoy!

    Reply
  30. Paula Clagon 3 May 2015 at 7:03 am

    Awesome. I am so new to wordpress, this help me tremendously. I kept asking the question in google about this px and rem and it lead me to your site. What a freaking life saver.

    Reply
  31. Carol 29 September 2015 at 11:24 pm

    Hello,

    Is this still working? I love this calculator but I seem to be having problems using it today.

    Thanks, Carol

    Reply
  32. Avatar photoAlec 30 September 2015 at 12:21 pm

    Thanks for the heads up Carol. We’ll get it fixed.

    Reply
  33. Carol 30 September 2015 at 5:14 pm

    Thank you for fixing this! I’ve found this to be very useful!

    Reply
  34. Avatar photoAlec 30 September 2015 at 5:47 pm

    Hi Carol,

    You’re welcome! Ironically, it was the WordPress built-in post editor which broke the calculator when we turned off our Foliopress WYSIWYG which allows code to live inside a post.

    Thanks for letting us know!

    Reply
  35. viktor 16 October 2015 at 7:02 am

    Hello all,

    we’ve just added a second calculator, that is using a different font-base for it’s calculations – 16px. The previous one for 14px works as before. Always check your theme style.css for initial font-size and use the coresponding calculator.

    Thank you for all your input.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You can click here to Subscribe without commenting

Primary Sidebar

WordPress

  1. StudioPress Tutorials
  2. WordPress Tutorial Videos for Foliovision Clients
  3. WordPress Plugins
  4. Shared.css Framework
  5. WordPress How To Guides
  6. WordPress Plugin Reviews

Categories

  • Business
  • Camera Reviews
  • Case Studies
  • Design
  • FV Player
  • Internet Marketing
  • IT
  • Life
  • SEO
  • Slovak
  • Video of the Week
  • WordPress

Footer

Our Plugins

  • FV WordPress Flowplayer
  • FV Thoughtful Comments
  • FV Simpler SEO
  • FV Antispam
  • FV Gravatar Cache
  • FV Testimonials

Free Tools

  • Pandoc Online
  • Article spinner
  • WordPress Password Finder
  • Delete LinkedIn Account
  • Responsive Design Calculator
Foliovision logo
All materials © 2025 Foliovision s.r.o. | Panská 12 - 81101 Bratislava - Slovakia | info@foliovision.com
  • This Site Uses Cookies
  • Privacy Policy
  • Terms of Service
  • Site Map
  • Contact
  • Tel. ‭+421 2/5292 0086‬

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in .

Powered by  GDPR Cookie Compliance
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Necessary Cookies

Strictly Necessary Cookie allow you to log in and download your software or post to forums.

We use the WordPress login cookie and the session cookie.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

Support Cookies

Foliovision.com uses self-hosted Rocket.chat and self-hosted Freescout support desk to provide support for FV Player users. These cookies allow our visitors to chat with us and/or submit support tickets.

We are delighted to recommend self-hosted Rocket.chat and especially Freescout to other privacy-conscious independent publishers who would prefer to self-host support.

Please enable Strictly Necessary Cookies first so that we can save your preferences!

3rd Party Cookies

This website uses Google Analytics and Statcounter to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping this cookie enabled helps us to improve our website.

We reluctantly use Google Analytics as it helps us to test FV Player against popular Google Analytics features. Feel free to turn off these cookies if they make you feel uncomfortable.

Statcounter is an independent Irish stats service which we have been using since the beginning of recorded time, sixteen years ago.

Please enable Strictly Necessary Cookies first so that we can save your preferences!