Recent studies suggest that small and large earthquakes nucleate similarly, and that they often have indistinguishable seismic waveform onsets. The characterization of earthquakes in real time, such as for earthquake early warning, therefore requires a flexible modeling approach that allows a small earthquake to become large as fault rupture evolves over time. Here, we present a modeling approach that generates a set of output parameters and uncertainty estimates that are consistent with both small/moderate (≤M6.5) and large earthquakes (>M6.5) as is required for a robust parameter interpretation and shaking forecast. Our approach treats earthquakes over the entire range of magnitudes (>M2) as finite line-source ruptures, with the dimensions of small earthquakes being very small (<100 m) and those of large earthquakes exceeding several tens to hundreds of kilometres in length. The extent of the assumed line source is estimated from the level and distribution of high-frequency peak acceleration amplitudes observed in a local seismic network. High-frequency motions are well suited for this approach, because they are mainly controlled by the distance to the rupturing fault. Observed ground-motion patterns are compared with theoretical templates modeled from empirical ground-motion prediction equations to determine the best line source and uncertainties. Our algorithm extends earlier work by Böse et al. for large finite-fault ruptures. This paper gives a detailed summary of the new algorithm and its offline performance for the 2016 M7.0 Kumamoto, Japan and 2014 M6.0 South Napa, California earthquakes, as well as its performance for about 100 real-time detected local earthquakes (2.2 ≤ M ≤ 5.1) in California. For most events, both the rupture length and the strike are well constrained within a few seconds (<10 s) of the event origin. In large earthquakes, this could allow for providing warnings of up to several tens of seconds. The algorithm could also be useful for resolving fault plane ambiguities of focal mechanisms and identification of rupturing faults for earthquakes as small as M2.5