Center Text
Center lines within width.
Center text within width instantly.
Calculator Inputs
About Center
Center lines within width.
Pads with spaces.
Where it is used
ASCII art, CLI banners.
How to use the Center
- Text — enter the value (e.g. hello).
- Width — enter the value (e.g. 40).
- Calculate — press the Calculate button to see the result instantly above.
Formula
Pad left floor((w-len)/2), right ceil.
Examples
Example
inputText:hi
width:10
Result: hi
Frequently Asked Questions
- Tabs?
- Count as 1.