PCB enclosures for Arduino, ESP32, Raspberry Pi and custom boards

Raspberry Pi 4 and Pi 5 case, 3D printed: the 58 x 49 mm hole pattern, every port, and a prompt

Both boards are 85 x 56 mm with M2.5 holes on 58 x 49 mm, but the ports moved. Port positions for the Pi 4 and Pi 5, cooling options, and a snap-fit case prompt.
8 September 2026 · 3 min readelectronicsenclosuresraspberry pi

Same footprint, different ports

MeasurementPi 4 Model BPi 5
Board outline85 x 56 mm85 x 56 mm
Mounting holes4 x 2.7 mm on a 58 x 49 mm pattern, 3.5 mm from the edgesSame
PowerUSB-C, long edge, about 11 mm from the cornerUSB-C, long edge, about 11 mm from the corner
Video2 x micro HDMI, long edge, at about 26 and 39.5 mm2 x micro HDMI, long edge, at about 26 and 39.5 mm
Audio jack3.5 mm at about 54 mm on the long edgeNone
USB / EthernetShort edge: 2 x USB 3, 2 x USB 2, EthernetShort edge: 2 x USB 3, 2 x USB 2, Ethernet (Ethernet moved to the other side of the USB stack)
microSDUnderside, short edge opposite the USB stackSame
ExtraPower button, PCIe FPC, two camera/display FPC connectors on the long edge, RTC battery header
CoolingPassive OK with a heatsink; fan for sustained loadActive Cooler recommended, 60 x 40 mm footprint, 20 mm tall

Because the Ethernet and USB stack swapped sides on the Pi 5, a Pi 4 case does not fit a Pi 5. The hole pattern and the power/HDMI edge are the same, so the base is nearly reusable and the short-edge cutouts are not.

Cooling first

The Pi 5 throttles without cooling. If you use the official Active Cooler, the lid needs a 60 x 40 mm opening above it and about 22 mm of internal height. If you use a fan HAT or a passive heatsink, say so; the case gets a 30 or 40 mm fan grille or a hex-vent field instead. For a Pi 4, a 30 mm fan on the lid over the SoC is the usual answer.

The prompt

Prompt
A two-part snap-fit case for a Raspberry Pi 5, board 85 x 56 mm, M2.5 standoffs 3 mm tall on a 58 x 49 mm pattern 3.5 mm from the edges. 2 mm walls, 0.5 mm clearance, 24 mm internal height. Lid with a 60 x 40 mm opening above the Active Cooler. Cutouts on the long edge for USB-C power, two micro HDMI and the power button; the short edge open for the USB stack and Ethernet; a microSD slot on the opposite short edge at floor level.

Change "Pi 5" to "Pi 4 Model B" and add "a 3.5 mm audio jack hole at 54 mm on the long edge and a 30 mm fan grille in the lid" for the Pi 4.

HATs and taller stacks

A HAT on the 40-pin header sits 11 mm above the board plus its own components. A Pi with a HAT needs 30 to 35 mm of internal height and usually a slot in the lid above the HAT's connectors. Ask for "35 mm internal height and the lid open above the HAT area" and the case adapts.

Mounting the case

  • VESA 75 or 100 holes on the back to hang the Pi behind a monitor
  • DIN-rail clip for a cabinet
  • Two keyholes for a wall
  • A slot for a 10 mm strap under a desk

Any of these is one sentence after the case exists.

Library parts

Pre-filled prompts: Pi 5 case with Active Cooler cutout, vented Pi 4 case, Pi 5 case for the Hailo AI HAT, and a Pi 4 wall-mount plate.

Prompts to start from

Open one in the builder, change the numbers to yours, and the model renders in seconds. Keep adjusting in the chat before you print.

A two-part snap-fit case for a Raspberry Pi 5, board 85 x 56 mm, M2.5 standoffs 3 mm tall on a 58 x 49 mm pattern 3.5 mm from the edges. 2 mm walls, 0.5 mm clearance, 24 mm internal height. Lid with a 60 x 40 mm opening above the Active Cooler. Cutouts on the long edge for USB-C power, two micro HDMI and the power button; the short edge open for the USB stack and Ethernet; a microSD slot on the opposite short edge at floor level.

Open in the builderPre-filled after sign-in. Preview is free.

A vented two-part case for a Raspberry Pi 4 Model B (85 x 56 mm, 58 x 49 mm hole pattern), 2 mm walls, 0.5 mm clearance, 20 mm internal height, cutouts for USB-C, two micro HDMI and the audio jack on the long edge, the short edge open for USB and Ethernet, a 30 mm fan grille in the lid over the SoC and hex vents on the sides.

Open in the builderPre-filled after sign-in. Preview is free.

A Raspberry Pi 5 case with 35 mm internal height for a HAT on the 40-pin header, M2.5 standoffs on 58 x 49 mm, the lid open above the HAT area, all Pi 5 port cutouts, and VESA 100 mounting holes on the back.

Open in the builderPre-filled after sign-in. Preview is free.

Questions

No. The hole pattern and the power/HDMI edge match, but the Pi 5 swapped the Ethernet and USB positions, dropped the audio jack and added a power button. The short-edge cutouts do not line up.

About 24 mm inside with 3 mm standoffs. The cooler is 20 mm tall and needs the lid open above it, or 5 mm of air plus a vent grille.

Yes. Ask for more internal height and an open lid area above the HAT. Because the case is parametric, the standoffs and cutouts stay where they are and only the height changes.

Generate the enclosure for your board

Describe the board, the ports and how the lid closes. The case renders in your browser in seconds and every cutout is a sentence away from moving. Preview is free.