viljandi (, ) is a town and municipality in southern estonia. as of 2012, 19,150 people lived there. it is the capital of viljandi county. the town was first mentioned in 1283, after being given its town charter by villekinus de endorpe.