We present a compact modeling framework to optimize finger spacing for improving the thermal stability in multifinger bipolar transistors with shallow-trench isolation. First, we present an accurate physics-based model for total junction temperature in all the fingers of a transistor. Other than validating the model with 3-D TCAD simulations and measured data, we demonstrate its efficacy to achieve finger spacing optimization with the aid of an iterative algorithm. Since the proposed technique is scalable from the viewpoint of the number of fingers within a transistor and their geometries, the proposed framework is found to work seamlessly for various emitter finger numbers.