Can swordtails live with pencilfish?

Verdict
Yes

Yes, swordtails and pencilfish can live together. Both are fine at 75–79°F. Plan on at least 30 gal.

Why it works

Water side by side

55°60°65°70°75°80°85°90°Both: 75–79°Swordtail 72–79°Pencilfish 75–82°
The green band is the temperature range both can live in.
456789Both: 7–7.5Swordtail 7–8.3Pencilfish 5–7.5
The green band is the pH both tolerate.

Size to scale

Swordtail · 5 inPencilfish · 2 in0"1"2"3"4"5"6"
Adult length in an aquarium. A fish can swallow anything that fits in its mouth, roughly a third to half its own length for predators.

Care at a glance

SwordtailPencilfish
Temperature72–79 °F75–82 °F
pH7–8.35–7.5
Adult size5.0 in2.0 in
Minimum tank30 gal15 gal
TemperamentSemi-aggressivePeaceful
Swims atMiddleMiddle
GroupGroups of 3+Groups of 6+
DietOmnivoreOmnivore

Better tank mates for swordtails

All swordtail tank mates

Better tank mates for pencilfish

All pencilfish tank mates

Questions

Can swordtails live with pencilfish?

Yes, swordtails and pencilfish can live together. Both are fine at 75–79°F. Plan on at least 30 gal.

What temperature suits both swordtails and pencilfish?

75–79 °F. Swordtails need 72–79 °F, pencilfish need 75–82 °F.

What size tank do swordtails and pencilfish need together?

At least 30 gal, set by the swordtail. Add space for each extra fish.