EDIT: Disregard the stuff below as regards PAL. I failed to take account of the fact that the PAL C64 uses a slightly non-standard line frequency, which causes the lines on an an analogue PAL screen to be slightly further apart from each other than the standard has them. See here: Pixel Aspect Ratio
Taking that into account, the pixel aspect ratio for a PAL C64 is a much simpler value. It is 59:63.
Here's a table of pixel aspect ratios of different Commodore and Apple machines (as they are after power on without any register tweaking), taking this into account. E.g. "118:71" means, 118 lines high equals 71 pixels wide. I've also given the maximum sized perfect square you can draw on the main screen area of that machine, with the register settings as they are after normal power on reset (i.e. without tricks such as opening borders, changing frequencies, adjusting timing registers, putting the VDC in 40-chars-per-line mode etc.). You can use that to adjust your screen height and width.
| Machine | TV System | Pixel aspect ratio | Maximum Square |
| VIC-20 | NTSC | 3:2 | X=122 Y=183 |
| VIC-20 | PAL | 118:71 | X= 71 Y=118 |
| C64,C128 | NTSC | 3:4 | X=264 Y=198 |
| C64,C128 | PAL | 59:63 | X=189 Y=177 |
| C128 VDC | NTSC | 195:508 | X=508 Y=195 |
| C128 VDC | PAL | 59:128 | X=384 Y=177 |
| C16,Plus/4 | NTSC | 65:76 | X=228 Y=195 |
| C16,Plus/4 | PAL | 59:57 | X=171 Y=177 |
| Apple II+ | NTSC | 65:76 | X=152 Y=130 |
| Apple II+ | PAL | 59:57 | X=171 Y=177 |
The Apple II+ values are also valid for all other Apple II machines (including the IIgs) as long as they are in II+ compatible display modes, i.e., 40-column text, standard hires, and the mixed mode combining those two. In the //e and above Double-Hires or the IIgs Super-Hires modes, double the 76 or the 57.
The values for PET (with and without CRTC) and CBM-II are missing. I'm not sure about their dot-clock and cycles-per-line values.
DISREGARD THE FOLLOWING AS REGARDS PAL: The best way to calculate the answer is by using the dot clock values. Industry standards mandate that for a full-frame 480 line NTSC picture at a dot clock of exactly 13.5 MHz, the pixel aspect ratio is exactly defined as 11 dots wide equal 10 lines high, so for square pixels, you need a dot clock of 135/11≈12.27272 MHz. For a 576-line PAL frame, the same dot clock gives pixels where 54 dots wide equal 59 lines high, so for square pixels the required dot clock is 59/4=14.75 MHz. With the C64 dot clocks, PAL color clock times sixteen over nine, which is 709379/90000≈7.882 MHz, or NTSC color clock times sixteen over seven which gives 90/11≈8.182 MHz, and the fact that the Commodores use non-interlaced modes that are half as many lines high as full frames, the NTSC C64’s pixel aspect ratio comes out as (135/11)/(90/11)/2, exactly 3:4 or 0.75, three lines high equal four pixels wide. The PAL C64 gives (59/4)/(709379/90000)/2, the rather unwieldy exact value of 663750:709379, which comes out at about 0.93568; that means that 160 lines high almost exactly equal 171 pixel wide; the error is less than 1/1000 pixel, far below the limit of how well even professional equipment can be adjusted.