Menu Search
Jump to the content X X
Smashing Conf Barcelona 2016

We use ad-blockers as well, you know. We gotta keep those servers running though. Did you know that we publish useful books and run friendly conferences — crafted for pros like yourself? E.g. upcoming SmashingConf Barcelona, dedicated to smart front-end techniques and design patterns.

Applying Mathematics To Web Design

“Mathematics is beautiful.” This may sound absurd to people who wince at numbers and equations. But some of the most beautiful things in nature and our universe exhibit mathematical properties, from the smallest seashell to the biggest whirlpool galaxies. In fact, one of the greatest ancient philosophers, Aristotle, said: “The mathematical sciences particularly exhibit order, symmetry and limitation; and these are the greatest forms of the beautiful.”

Because of its beautiful nature, mathematics has been a part of art and architectural design for ages. But it has not been exploited much for website design. This is probably because many of us regard mathematics as being antithetical to creativity. On the contrary, mathematics can be a tool to produce creative designs. That said, you don’t have to rely on math for every design. The point is that you should regard it as your friend, not a foe. For illustrative purposes, we created a couple of web designs that present mathematical principles discussed in this article. We are also giving away a couple of PSDs that you can use right away in your next design.

Layouts featured in this post were created specifically for the purpose of this article. During the design process we made sure that all of the designs shown in this article are essentially mathematical in nature; that is, they exhibit order, symmetry and limitation. We also have followed the Web design algorithm1 in this process — the designs have distinct themes, styles and elements. To keep things simple and clear, we tried to stick to minimalist designs and also preferred single-page layouts. Obviously, examples in this article are supposed to serve as a simple foundation for your designs and not as the finished designs.

Golden Ratio and Golden Rectangle Link

The golden ratio, also known as the divine proportion, is an irrational mathematical constant with a value of approximately 1.618033987. If the ratio of the sum of the quantities to the larger quantity is equal to the ratio of the larger quantity to the smaller one, then the quantities are said to have a golden ratio.



We already published a very detailed article “Applying Divine Proportion To Web Design”2 that explains how to use the golden ratio in Web design. In today’s article, we’ll look at how to use golden rectangles in Web design. A golden rectangle is one whose side lengths have the golden ratio 1:(one-to-phi); that is, 1:1.618.

The construction of a golden rectangle is very easy and straightforward. First, construct a simple square. Then draw a line from the midpoint of one side of the square to an opposite corner and use that line as the radius to draw an arc that defines the height of the rectangle. Finally, complete the golden rectangle and you are done.

A method to construct a golden rectangle. The square is outlined in red. The resulting dimensions are in the ratio 1:Phi, the golden ratio.
A method to construct a golden rectangle. The square is outlined in red. The resulting dimensions are in the ratio 1:Phi, the golden ratio.

As an example, consider the minimalist design below. It has six golden rectangles in it, three rectangles per line. The rectangles have the dimensions of 299 x 185 pixels. Thus, the sides of these rectangles adhere approximately to the golden ratio; that is, 299/185 = 1.616. Notice how the large amount of white space surrounding Golden rectangles creates a calm and simple atmosphere in which the navigation options can breathe and serve their purpose. Although the layout uses only few colors and all blocks are positioned very similarly, the navigation options are obvious.

Large view4

However, it may be quite difficult to add a new Golden block while keeping the consistency of the design. Probably the only reasonable design solution here would be to add the block on the third line and use the rest of the horizontal space for other, more or less prominent features (if necessary). You can click on the image below to see the enlarged version.

Large view6

Possible Applications Link

The golden rectangle design is well suited for photo galleries, portfolios and product-oriented websites. The golden rectangles can also be arranged in other mathematically sound ways to generate beautiful designs. In particular, you may want to use them for blocks that display images or ads in your sidebar. Of course, the pure collection of golden rectangles doesn’t make for a professional, nice-looking design. You also need to work closely with grids, alignment, proximity and emphasis to achieve the main goals of your design. For instance, an interesting design solution would be a CSS/jQuery-based fluid grid design based on golden rectangles, however we do not cover this technique in this article.

Download the PSD-layout Link

We prepared a sample PSD layout7 that is designed according to the Golden Ratio and Golden Rectangle. Please feel free to use it in any way and please send the link to this article to your colleagues if you want to spread the word.

Fibonacci Design Link

As the name says, Fibonacci designs are designs based on the Fibonacci sequence of numbers. By definition, the first two Fibonacci numbers are 0 and 1, and each remaining number is the sum of the previous two. Some sources omit the initial 0, instead beginning the sequence with two 1s. So the first two Fibonacci numbers are given, and each remaining number is the sum of the previous two. The higher the Fibonacci sequence gets, the closer its numbers relate to each other according to the Golden Ratio. A Fibonacci sequence goes like this:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...

In music, Fibonacci numbers are sometimes used to determine tunings, and in visual art to determine the length or size of content and formal elements. Jürgen Schmidhuber his methodology for Fibonacci-based designs8 on his blog. However, if you examine the design he created, you are likely to find it rigid and a bit difficult to read and navigate. Indeed, you need to get a bit creative with math rather than following the rules blindly — maths gives us a guide that we can apply, however it’s rather about implementing sites with maths than implementing maths with our designs.

Fibonacci sequence9
Approximate and true golden spirals. The green spiral is made from quarter-circles tangent to the interior of each square, while the red spiral is a Golden Spiral, a special type of logarithmic spiral. Overlapping portions appear yellow. The length of the side of one square divided by that of the next smaller square is the Golden ratio. Source10

The main idea behind such designs is to use Fibonacci when deciding on the dimensions for content area or sidebar. Both Golden ratio and Fibonacci let designers rely on sound, common ratios for page containers or blocks within page containers.

In general, layouts are quite easy to build using the Fibonacci sequence. You pick a certain base width first — for instance, 90px. Then, when determining the size of your containers, you multiply the base width with the numbers from the Fibonacci series. Depending on the calculations you get, you need to use them for your page blocks. Let’s take a look at an example. Below is a minimalist typography blog based on Fibonacci Web design.

Large view12

You can see that the page is divided into three columns. Each column corresponds to a Fibonacci number. For this design, we used a base width of 90 pixels. This base width is then multiplied by a Fibonacci number to get the total width for a particular column. For example, the first column has a width of 180 pixels (90 x 2); the second column has a width of 270 pixels (90 x 3); and the third column has a width of 720 pixels (90 x 8). The font size also corresponds to a Fibonacci number. The blog heading has a size of 55px; the article’s heading is 34px; and the content is 21px.


The downside of layouts based on the Fibonacci sequence is that it’s difficult to use it if you are given certain fixed width layout dimensions (e.g. 1000px). In this situation it’s easier to use the Golden ratio, as you would simply multiply 1000px with 0.618 and get 618px which would be the ideal width for your content block. However, if you try to achieve the same result with the Fibonacci sequence itself, you first need to figure out the sequence to the 1000 range.

According to the Fibonacci sequence calculator13, the sequence would be ...,610, 987, 1597.... Indeed, 987 is a good fit and you can start picking the widths for smaller blocks using the previous numbers in the sequence. But if your fixed width layout is smaller or lager, you would need to use some approximate values which would again result in pure guessing. The problem may also occur in liquid or elastic designs to some extent, but you have much more design freedom there.

Possible Applications Link

A Fibonacci design is best suited to blogs and magazine layouts. You can arrange the layout in different ways according to Fibonacci numbers. The article “Nombre d’or, suite de Fibonacci et autres grilles de mise en page pour le design web”14 (in French) explains in more depth the application of Fibonacci numbers to Web design. Again, notice that you need to be creative when using Fibonacci sequence in your designs, otherwise your designs will turn out to be too rigid and hence difficult to use and navigate.

Download the PSD-layout Link

We prepared a sample PSD layout15 that is designed according to the Fibonacci sequence. Please feel free to use it in any way and please send the link to this article to your colleagues if you want to spread the word.

Five Elements, Or Kundli Design Link

Another interesting layout technique comes from the Indian horoscopes which are also called Kundli. Basically, a Kundli is a very simple figure can be made in just three steps. Draw a square, and then cross the two diagonals. Join the mid-points on each side of the square to get the Kundli figure. You’ll notice four right-angle rhomboids in the figure. These are the basis for our Web design.



The design below, then, is based on the Kundli geometric layout. You’ll notice that the chakras16 in the design also have mathematical properties.

Large view18

This is a single-page layout. Clicking on an element reveals more information about it, as shown in the figure below. You could also include some simple jQuery animations or jQuery tooltips that would reveal more information on demand. A further step would be a sliding web page where animation is used to display different content blocks; you may also want to change the background images of the single content areas to make them a bit more distinctive.


In the following figure, you can see that our design is just a simple three-column layout: a header, three columns and a footer. Not complex at all.


Possible Applications Link

This design is best for displaying product information and portfolios. You can spice it up with JavaScript animation frameworks. For example, you can apply color transformations to the chakras by using Raphael library, or you can add freestyle animations using  jsAnim19 library. You can have a tree sprout when the user clicks on the Earth element, or you can show sea creatures swimming in the water element. The sky is the limit when it comes to animation using these JavaScript libraries.

Download the PSD-layout Link

We prepared a sample PSD layout20 that is designed according to the Kundli design. Please feel free to use it in any way and please send the link to this article to your colleagues if you want to spread the word.

Sine Wave Design Link

When it comes to mathmatics, you do not need to stick to well-known Golden Ratio or Fibonacci sequence. You can also experiment with formulas from physics, chemistry and other sciences by using more general formulas and values in your designs.


For instance, let’s consider the sine wave, or sinusoid, a mathematical function that describes a smooth repetitive oscillation. We used a simple sine wave pattern as the basis for a simple and original Web design and create a single-page layout. Of course, you can use the same approach for other designs such as graphics or infographics.

Large view22

The layout is again very simple, consisting of a header, five columns and a footer. You can use a jQuery tooltip to make the design more interactive.


Possible Applications Link

This wave pattern occurs often in nature, including ocean waves, sound waves, and light waves. Also, a rough sinusoidal pattern can be seen in plotting average daily temperatures for each day of the year, although the graph may resemble an inverted cosine wave. You can also use it to display a timeline of events. It could even be developed to include horizontal navigation. You can make it more interactive with the jQuery highlighter plug-in, which highlights each element (i.e. DIV) so that the user can focus on the content.

Download the PSD-layout Link

We prepared a sample PSD layout23 that is designed according to the Sine Wave design. Please feel free to use it in any way and please send the link to this article to your colleagues if you want to spread the word.

Other Techniques Link

Rule of Thirds
This rule states that an image should be imagined to be divided into nine equal parts by two equally spaced horizontal lines and two equally spaced vertical lines, and that important compositional elements should be placed along these lines or their intersections. It can also be expressed as a simplified mathematical approach that divides any layout into thirds, left to right and top to bottom.

Musical Logic
The rhythmic or thematic structure of musical compositions can be applied to distances between elements in a layout, like ABA, ABAC, etc. Learn more about music and mathematics in this Wikipedia article24.

Wikipedia articles



We hope you’ve enjoyed this article on mathematics and Web design. Hopefully you now see mathematics not as a hindrance to creativity, but as a friend. Embrace it!


Footnotes Link

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34'elements&num=4&client=internal-uds&cd=4&source=uds#v=onepage&q=&f=false
  35. 35
SmashingConf Barcelona 2016

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.

↑ Back to top Tweet itShare on Facebook


I am a web designer and developer from India. I have deep interests in computer science, art, math and astrophysics in-spite of the fact that I graduated as a Petroleum Engineer. I am a devoted fan of Salvador Dali and have spent a considerable amount of time in studying various art movements. I spend most of my time in web design and in coming up with new ideas to enhance productivity. Oh, and this is an additional but somewhat useless fact - I have four international research papers in the field of petroleum engineering.

  1. 1

    haydyn phillips

    February 9, 2010 5:11 am

    Also to be highly considered is the root 2 rectangle system which is a sure fire way of designing spot on asymmetrical/symmetrical balanced designs. As it is based on the DIN paper sizes it would be worth getting some standard print sizes and converting them into px or em to conceive a modular structure which will work every time. If you get the base maths right every proportion you make will be balanced.

  2. 2

    Brilliant post.

  3. 3

    That was an interesting read. I love math :) and design.

  4. 4

    Design for your right brain, and math for your left brain. Make it balance :D

  5. 5

    Very interesting. I have used the Golden Ratio before, and one of my design teachers in college explained the rule of thirds, and had us examine classical pieces of art to understand how it can be broken down, and how to lead the eye.

    It is very important to make the eye flow on the page correctly, and math and these ancient rules that have been used in art and architecture for a long time do just that.

  6. 6

    Good Stuff! I have the last few days been reading other sources on the subject – Did you read my mind?!

  7. 7

    I love the golden ratio for ages. The idea with a sine wave is also interesting. Maths and design and other arts enrich each other.

  8. 8

    Excellent post !!!
    write more like this articles, friend.
    Congratulations :)

  9. 9

    I love articles like that! Thank you!

    (and suddenly, i feel i’m not so alone)

  10. 10

    An excellent posting! So many designer don’t make the effort to understand the concepts behind “beauty” and “harmony”.

    There are so many great examples in classic art and architecture out there that explore the maths / concepts behind proportions and sensible layouts.


  11. 11

    Great, good stuff, love it. Consider it embraced.

  12. 12

    Alexis Brille

    February 9, 2010 6:25 am

    Amazing. This is incredible.

  13. 13

    This was exactly what I always was searching for. – Thanx a lot.

  14. 14

    My brain now hurts, thanks a lot. I went into design because I couldn’t do math and now you are trying to scare me. To you sir, I say poo

    • 15

      So you should consider not being a good designer if you’re not able to understand the math behind design, they need to be together in order to create balance and harmony, is not just about “making things pretty”.

    • 17

      Designers work with grids and grids is geometry and geometry is math. So, we are always using Math. :) I have stated in the article that it’s not necessary to always use other mathematical techniques in your web design. It should be used as a tool rather than as a compulsion. :)

  15. 18

    Very cool! Math is such an interesting thing. I have been learning all this in my art history and design classes, the examples were spot on. Thanks.

  16. 19

    I’m just wondering if there is any direct benefit of using, say for example, a Fibonacci-based design versus a layout that doesn’t. Will it achieve better landing page conversions? Does it make a web page more readable? Or scannable? Will it make designing a web page faster? Will it make page response times quicker?

    Yes, the Fibonacci number, the Golden Ratio, and all of these mathematical principles have been applied in other fields before, but does that automatically mean it has its applications to designing a website?

    Saying that the Golden Ratio has been applied to architectural design but not much in Web design is like saying, “Airplanes have wings and they travel fast–maybe we should put wings on cars too!”

    Design should be purposeful; it’s a tool to get your objectives done. Don’t make it fit, if it doesn’t. If a Sine Wave layout gives you direct and tangible benefits (maybe test via A/B study?) versus one that doesn’t, then it should be applied in the field of web design. But just based on my opinion, the Sine Wave layout is kind of difficult to read. The eye flow is unnatural (at least to LTR readers such as myself).

    My two cents and I’d be interested what you folks think.

    • 20

      Hello Jacob! I really appreciate your comment. I would like to touch upon a few things regarding this article:
      1. The article is primarily concerned with simple application of mathematics in Design. We all know that designing is all about arranging elements with an aesthetic sense keeping functionality in mind. I can say that Fibonacci design is certainly readable not only because of typographic rhythm offered by Fibonacci numbers but also because it has an intuitive navigation. There is no need for buttons as the navigation flow is quite natural. Hence, the design has also achieved functionality. Things like making web page faster or
      making page response time quicker will take us more into development side. However, that also could be achieved.

      2. As said in the article, it’s not necessary to always use mathematics in your web design. Rather it can be used as a tool to come up with creative designs. I mostly come across two column designs on the web. Honestly speaking, they have become the Helvetica of page layouts. Even though it looks good, it has become boring. We see them nearly everywhere, even I designed my blog like that!!! Hence, I decided to come up with a different approach using mathematics as a tool.

      3. The sine wave design is different in the sense that it does not follow the normal two or three column layouts. You can see that the content in the design is not linked to each other. They are all independent. The purpose of the design was to give this independence to the reader. The reader can look at any content and still get the intended message, that is a simple brief about the books. However, elements cannot be arranged randomly and hence a rhtymic pattern was followed to take care of the design aesthetic sense.

      Again, Mathematics gives you an option to explore more in design. Also, mathematics gives a discipline to a design. One of the greatest designers, Massimo Vignelli has said- “There is no design without discipline.” :)

      And yes, cars are going to have wings pretty soon. A project is already at going on at MIT and we will soon have flying cars too!! :)

      • 21

        You presented the concepts accurately and made no claims that “this is automatically better versus this because it uses cool awesome equations” so don’t feel obligated to defend your work because it’s great. I was merely asking a question in general to the community about the fact that, “Yes, you can use them in web design, but should you? And if so, why?”

        If the argument is: “To be different from other common layouts” – then why use mathematical equations at all? Go freestyle!

        The point I’m driving at is this: “Do they really translate well on the web? And why do it? What benefits are there to be had?”

        My point about the airplanes and car analogy was: “Why would you put wings on a car when its purpose is not to fly, but to use roads?” Just because it works well for a similar thing (architecture/web design are similar because they both involve design just like a plane/car are similar because they’re both transportation), doesn’t automatically mean that it works or fits another.

        Putting wings on a car means you’re making an airplane (or a hybrid car and airplane).

        Web design is tricky in that we have many different goals, mostly having to deal with readability, findability, content presentation, and landing page conversion.

        What I’m afraid of seeing is designers spending ludicrous amounts of hours trying to make their layout embody some sort of Fibonacci ratio or make sacrifices to their designs because some equation tells them that it’s got to be a certain width or position when there is no (at least, not yet) study that proves that it makes your site design more effective in achieving its purpose or that does it makes it any more aesthetically-pleasing.

        I write this solely from personal experience, and nothing more. I recently gave up on 960gs because I found that I was spending way too much time constraining myself to self-imposed limits that the layout affords me, rescaling and making sacrifices to make design elements fit, when there is no tangible proof that a grid-based system versus a layout with no system at all, is more readable, more usable, or, overall, provides a better experience to your viewers. It was supposed to speed up web design – but because of the self-imposed limits – it actually slowed it down.

        In short: yes you can use Golden Ratio, Fibonacci Numbers, etc. (and I even covered it in the chapter I wrote in the Smashing Book) – but to what end? Beauty is subjective, and most people wouldn’t know or see the difference between a site that uses the Divine Proportion versus one that doesn’t.

        And finally, “Again, Mathematics gives you an option to explore more in design.”

        I think the opposite is true. It gives you self-imposed constraints, such as the Golden Ratio. There is no experimentation or exploration in a Golden Ratio layout; you plug in a total width, and it will tell you what your column sizes should be.

        • 22

          @Jacob Thanks again for your reply. :)

          I have nothing against freestyle design. Also, I am not asking to always use mathematics for designing their websites. I believe that we should all just try to get creative with our designs without making any compromises on functionality. Now, an individual can get creative by either opting for freestyle design or by using math as a tool in web design. I also do freestyle designs and forthcoming articles on my blog would also touch upon that. However, a very important thing is that the freestyle design should also be able convey the purpose. Otherwise it will become fine art and not design. Nevertheless, the purpose is to get creative in different possible ways. :)

          Math exists everywhere around us. Even when designing, we are talking about pixels, width, height, etc – All this is Math. :) So, if we can make a design beautiful and functional with some mathematical principles, then the designer should be quite happy with it. :)

          I believe that design and art are two separate things. I have covered a topic on my blog wherein I have demonstrated how some artistic styles can be used in design. But still, the design should remain functional and balanced or else it will end up being a chaos. The principles of balance and harmony separates a designer from an artist. An artist can use his brush on the canvas with all the freedom to convey his thought because he is not essentially painting for the user. He is expressing himself with his art. However, a designer has to keep the user in his mind because he is not just expressing his thoughts here but also his purpose is to convey some form of information. For conveying information, we need a medium which is balanced so that the user is not overwhelmed by overflow of information. It is here where mathematical principles can come handy. Things like Golden Rectangle and Fibonacci numbers give you an option to make your designs in a balanced way. However, I must say again that they are just tools and should never be taken as compulsive rules in web design.

        • 24

          I’ve always wondered about the 960 thing.

          I mean one of the big things about css was to allow us more freedom in our designs which was great. Then along comes someone espousing the benefits of a grid system and suddenly we’re can’t design a site without the rigidity of a grid.

          Yes the rule of thirds, Fibonacci and all that gives some sort of order and balance which is good, but sometimes you have to step away from that and just do what works.

  17. 25

    Steven Williams

    February 9, 2010 7:03 am

    Very interesting. Golden section proportioning and such theory are taught on my Graphic Design course at university and it’s useful to see how it can tie in to web design too.

  18. 26

    More about the rule of thirds briefly mentioned above:

    It’s old, but offers great examples.

  19. 27

    Really interesting stuff, it’s a shame I’m so numerically illiterate, because the principles look sound, but might as well be written in Greek (I guess they kind of are lol). I’m now looking at some websites and trying to figure out which mathematical principle they are following. I’m fairly sure that DubLi an approximation of the Fibonacci one?

  20. 28

    i love this post


↑ Back to top