The pseudo-algorithm below determines the used values for 'column-count' (N) and 'column-width' (W). There are two other variables There is one other variable in the pseudo-algorithm: U is the used width of the multi-column element.

Note: The used width U of the multi-column element can depend on the element's contents, in which case it also depends on the computed values of the 'column-count' and 'column-width' properties. This specification does not define how U is calculated. Another module (probably the Basic Box Model [[CSS3BOX]] or the Intrinsic & Extrinsic Sizing Module [[CSS3-SIZING]]) is expected to define this.

The floor(X) function rounds a number to the next smaller integer returns the largest integer YX.

(01)  if ((column-width = auto) and (column-count = auto)) then
(02)        exit; /* not a multicol element */

(03)  if ((available-width = unknown) and (column-count = auto)) then
(04)    exit; /* no columns */

(05)  if (available-width = unknown) and (column-count != auto) and (column-width != auto) then
(06)    N := column-count;  
(07)    W := column-width;
(08)    exit;

(09)  if (available-width = unknown) then
(10)    available-width := shrink-to-fit;

(11)  if (column-width = auto) and (column-count != auto) then
(12)    N := column-count;
(13)    W := max(0, (available-width U - ((N - 1) * column-gap)) / N);
(14)    exit;

(15)  if (column-width != auto) and (column-count = auto) then
(16)    N := max(1, floor((available-width U + column-gap) / (column-width + column-gap)));
(17)    W := ((available-width U + column-gap) / N) - column-gap;
(18)    exit;

(19)  if (column-width != auto) and (column-count != auto) then
(20)    N := min(column-count, floor((available-width U + column-gap) / (column-width + column-gap)))
(21)    N := max(1, N); 
(22)    W := ((available-width U + column-gap) / N) - column-gap;
(23)    exit

In paged media, user agents may perform this calculation on a per-page basis.

Note that, in most cases, only one of 'column-width' and 'column-count' affect the layout. If 'column-width' has a value other than ''auto'', 'column-count' indicates the maximum number of columns. However, both 'column-width' and 'column-count' are considered when the width of the element has not been determined depends on its contents. This can, e.g., be the case for table cells and floats.