Every full-size Raspberry Pi, from the 2014 B+ to the Pi 5, bolts down through the same four holes: 58 × 49 mm, M2.5. What changes between models is everything around them: where the ports come out, how much heat the board gives off and what stacks on top. Do not measure the holes with callipers and round the result: copy the dimensions from the official drawing, reproduced below.
The hole pattern
Dimensions in mm, top view, measured from the lower-left corner of the board with the GPIO header along the top edge.
| Board | Outline | Holes | Positions | Pattern | Screw | Source |
|---|---|---|---|---|---|---|
| Pi 5, Pi 4 Model B, Pi 3B+ | 85 × 56, R3 corners | Ø2.7 (3B+: Ø2.75) | (3.5, 3.5), (61.5, 3.5), (3.5, 52.5), (61.5, 52.5) | 58 × 49 | M2.5 | Official mechanical drawings |
| Zero, Zero W, Zero 2 W | 65 × 30 | Ø2.75 | 3.5 in from the edges, at all four corners | 58 × 23 | M2.5 | Official mechanical drawings |
| Pico, Pico W, Pico 2, Pico 2 W | 21 × 51, 1.0 PCB | Ø2.1 | (4.8, 2.0) and mirrored | 11.4 × 47 | M2 | Pico and Pico 2 datasheets |
| HAT and HAT+ | 65 × 56 | over the Pi's 58 × 49 | classic HAT: all four; HAT+: at least one | 58 × 49 | M2.5 | HAT+ specification |
Source: the mechanical drawings published at datasheets.raspberrypi.com (the 2023 Pi 5 drawing, the Pico 2 datasheet). The drawings themselves warn that the dimensions are approximate and for reference. Raspberry Pi is a trademark of Raspberry Pi Ltd; this article and KapyCAD are not affiliated with or endorsed by it.
The 58 × 49 rectangle is not centered. It sits 3.5 mm from the edge at the GPIO and power end, and 23.5 mm (85 − 61.5) from the edge at the USB and Ethernet end. Center the pattern on the board and not one screw goes in. The Zero shares the 58 mm side with the big boards, but not the pattern: a Zero and a Pi 5 line up on only two of their four holes.
Your position budget is tiny. A Ø2.7 hole with a Ø2.5 screw leaves 0.2 mm on the diameter: ±0.1 mm per hole. That is all the position error each standoff can take. Dimension the exact centers, 58 × 49 from a single datum, with no added clearance and no eyeballing.
Around each hole is a component keep-out ring: Ø5.8 drawn on the Pi 5 drawing (measured off the vector artwork, not dimensioned), Ø6 dimensioned on the Zero's, Ø3.8 on the Pico. The top face of the standoff has to land inside that ring. Any wider and it can touch nearby components.
What changes on the Pi 5, Pi 500 and Pico 2
The Raspberry Pi 5 has the same 85 × 56 board and the same holes as the Pi 4. A Pi 4 case still will not fit it. On the right-hand edge, Ethernet and USB swap ends: the Pi 5's RJ45 sits at the bottom, centered at y ≈ 10.2, as on the 3B+; the Pi 4's sits at the top, at y ≈ 45.8. The 3.5 mm audio jack is gone. The two micro-HDMI ports shift slightly (x = 25.8 and 39.2 on the Pi 5; 26.0 and 39.5 on the Pi 4). On the left-hand edge you gain a power button and the PCIe flat-cable connector (16-pin). The microSD slot stays on the underside, on the left-hand edge.
The Pi 5 also has two Ø3 holes at (3.5, 9.5) and (61.5, 46.5), 6 mm from two of the mounting holes and diagonally opposite each other. They take the official Active Cooler, which clips on with two push pins whose tips poke out below the PCB. If you use it, leave a hole or a recess in the floor under each pin, and do not put a wide standoff in those two corners: a Ø8 one comes within 0.5 mm of the edge of those holes and the pin hits it.
The Pi 5 starts throttling at 80 °C and throttles harder at 85 °C; with the Active Cooler it stays well below that. In a closed box with no airflow, the hot air the fan blows out stays around your standoffs. Under load, PLA works up to about 40 °C, PETG up to 50 and ASA up to 80–85 (Heat, cold, sunlight and chemicals). For a closed Pi 5 enclosure, use PETG or ASA and give the air a way in and a way out (Fans and filters); a hot standoff holding a screw loses clamp over time (Creep and fatigue).
The Pi 500 and Pi 500+ are a Pi 5 inside a keyboard. There is no published mounting-hole pattern for the user, so you design around the outline instead: stands, tilt feet, wall cradles or under-desk brackets. According to their product briefs, the Pi 500 measures about 286 × 122 × 23 mm and the Pi 500+ about 312 × 123 × 36 mm. Measure your own unit and keep the rear ports and the vents clear.
The Pico 2 and Pico 2 W (2024, RP2350) are mechanically identical to the Pico: 21 × 51, Ø2.1 holes, castellated edge, 1.0 PCB. A Pico mount fits both. The Ø2.1 holes take M2, not M2.5. On the W versions the antenna sits at the end opposite the USB, and the datasheet asks for that area to be kept clear: thin plastic only, and nothing metal (screws, inserts, magnets) at that end.
Compute Module 5 and its carrier boards have their own patterns: use the carrier board's drawing.
Standoffs for M2.5
The standoffs from the enclosure floor to the Pi are printed; the brass standoffs between the Pi and a HAT are bought. These are the numbers for M2.5:
| Fastening | Hole | Standoff | Depth | When |
|---|---|---|---|---|
| M2.5 heat-set insert (4.0 long, Ø4.6) | Ø4.0 | Ø ≥ 7.2 (hole + 2 × 1.6); draw it at 8 | ≥ 5; 6 if the insert is sunk below a step | you will open it more than about 10 times |
| M2.5 self-tapping screw | Ø2.0–2.1 | Ø5 | ≥ 5 (2 × d) | you will rarely open it (≤ ~10) |
| Through hole and M2.5 nut | Ø2.9 (ISO 273, medium series) + your compensation | ≈ Ø8 | nut pocket 5.2 across flats (6.0 across corners), 2.2–2.3 deep | access from below |
| Pico, M2 | self-tapping Ø1.6–1.7 | Ø4 | ≥ 4 | any Pico |
Details in Designing for heat-set inserts, Self-tapping screws in plastic and Captive nuts and clearance holes; why the hole is not drawn at exactly 2.5, in Why holes print small. M2.5 inserts are less common than M3: buy them before you model the standoff. On the Pico, the M2 insert (Ø3.2 hole, standoff ≥ Ø5.8) covers the row of edge pins (x = 1.61) and hits the tails of soldered pins, so it only fits a Pico without pins; otherwise use the Ø4 self-tapping standoff, a through hole or a slot that grips the edge.
The insert standoff clashes with the keep-out ring: it is about 8 mm across and the ring is 5.8–6. Build it in two stages: below, Ø8 with the insert; on top, a Ø5.5–6 step 1 mm tall that the board rests on. The step only surrounds the Ø2.9 screw passage (about 1.3 mm of wall); if the insert came up into it, its Ø4.6 would leave 0.45 mm of wall and split when the hot insert goes in. So the insert sits below the step, and the hole is 1 of step + 4 of insert + 1 of free depth = 6 mm. If you will rarely open the enclosure, use the Ø5 self-tapping standoff, which already fits inside the ring. In the two Active Cooler corners, use one of these two.
Height is measured from the floor to the underside of the PCB. It has to clear the soldered tails of the GPIO header and anything else that hangs below the board: the microSD slot and, on a Pi 5 with the Active Cooler, the tips of its push pins. Allow 3 mm at the very least; 5–8 mm is typical.
Print the standoffs upright, with the hole axis vertical. You do it for a round hole, not for strength: in that orientation the screw pulls perpendicular to the layers, which is the weak direction (Layer adhesion and anisotropy). Make up for it with more wall, a fillet at the base (Ribs, gussets and fillets) and moderate torque.
Shrinkage hits the pattern too. Over 58 mm, PLA (0.2–0.5 %) shrinks 0.12–0.29 mm, and ABS or ASA 0.23–0.46 mm. Between two standoffs your budget is the two clearances added together, 0.2 mm: PLA runs close to the limit, ABS and ASA always exceed it, and then the fourth screw jams or bends the board. Correct shrinkage once, in the slicer's filament profile (Dimensional calibration); never scale the model of a standard.
Between the Pi and a HAT, use M2.5 brass standoffs (female-female or male-female); print only the standoffs on the base.
Worked example: the height of a Pi 5 enclosure with a HAT+
A Pi 5 with the Active Cooler and a HAT+ in a closed enclosure. Here is the height chain, from the outside of the base upwards:
| Element | Height (mm) | Source |
|---|---|---|
| Floor | 2 | your design |
| Printed standoff | 5 | your design |
| Pi 5 PCB | ≈ 1.4 | drawn on the drawing, not dimensioned: measure it |
| Brass standoff between boards | 16 | HAT+ specification: 15 minimum, 16 recommended |
| HAT+ PCB | ≈ 1.6 | typical: measure it |
| Tallest HAT component | — | whatever your HAT has |
| Air under the lid | ≥ 2 | margin |
| Total from the outside of the base | ≈ 28 + HAT components | sum |
| Internal height (without the floor) | ≈ 26 + HAT components | total − floor |
The 16 mm between boards needs a stacking header or pin extender of that same height: the HAT+ should come with its own, along with standoffs and screws. If the HAT+ has components on its underside, the specification asks for taller standoffs still. With a classic HAT, designed before the Pi 5, check that the cooler does not touch the HAT's underside: that is why the HAT+ specification asks for 15–16 mm.
The connector cutouts come out of the same chain. The connectors sit on the PCB, so the cutout starts at floor + standoff + PCB: 2 + 5 + 1.4 = 8.4 mm above the outside of the base. It extends upwards by the height of the connector (USB-C 3.2; micro-HDMI 3.4 on the Pi 5) plus clearance. Change the standoff height and every cutout moves. This is only the nominal chain; to add up its tolerances, see Assemblies and tolerance stackups.
Connector cutouts
Take the positions from the drawing for your model, not from a photo of a different one. Start with 0.5 mm of clearance per side around the connector body, and go up to 1.0 mm if the plug's molded housing is bigger than the connector. USB-C, HDMI and RJ45 are covered in detail in Connector cutouts.
The plug decides the wall thickness, not the connector on the board. The connectors overhang the edge of the PCB by 1.2 to 3 mm, and not all by the same amount on a given wall: on the Pi 5's bottom edge, the USB-C by 1.31 and the micro-HDMIs by 1.66; on the left, the PCIe by 1.73 and the microSD by about 1.6; on the right, the USB-A and RJ45 by about 3.0. Put the inside face of each wall 0.3–0.5 mm from the connector that sticks out furthest on it. A wall that touches the connectors pushes the board against the screws. If the plug's metal shell does not reach through the wall, thin the wall locally or cut a recess from the outside the size of the plug's molding. Measure your own cable's molding: there is no canonical figure.
The microSD is underneath, on the left-hand edge: leave a slot in the wall below the PCB or you will have to open the enclosure to swap the card. The Pi 5's power button is on the same edge: give it a hole or print a flexible push button (Living hinges and flexures).
When it fails
| Symptom | Cause | Fix |
|---|---|---|
| Three screws go in and the fourth jams | pattern drawn by hand, or material shrinkage | use the official dimensions; if it does not fit, calibrate the printer: the standard's dimensions stay as they are (Designing for an ecosystem) |
| Pi 4 case on a Pi 5: ports blocked | Ethernet and USB swap ends; no audio jack any more | pick the model and redo the cutouts |
| The plug will not go all the way in | wall too thick for the plug's molding | thin the wall locally or cut a recess |
| The standoff splits when the insert goes in | wall < 1.6 mm, or insert in a necked tip | standoff ≥ Ø7.2 (better 8) with the insert sunk below the step, or self-tapping |
| The board will not seat with the Active Cooler | the push pins hit the standoff or the floor | stepped or Ø5 standoff in those corners, recess under the pins |
| The board works loose after weeks in a closed enclosure | hot PLA gives way under the screw | switch to PETG or ASA, add airflow, retighten |
| HAT pins only half engaged | the standoff does not match the HAT's header | use the standoffs and header that came with the HAT, or a stacking header for 16 mm |
How to test it
Before you print the whole enclosure, print only the floor with the four standoffs, about 10 min, and screw the board down: all four screws should go in by hand without forcing the board. Then print a strip of wall with the cutouts and plug in the real cables (Test coupons).
See also
- Enclosures and mounts for Arduino: the Uno's irregular pattern and its M3 standoffs.
- ESP32 and other small boards: boards without mounting holes.
- Connector cutouts: USB-C, HDMI and RJ45 in detail.
- Designing for heat-set inserts: the hole, the wall and fitting the insert.