JavaScript String padEnd() Method Last Updated : 12 Jul, 2025 Comments Improve Suggest changes 1 Likes Like Report The padEnd() method in JavaScript is used to pad a string with another string until it reaches the given length. The padding is applied from the right end of the string.Syntax:string.padEnd( targetLength, padString );Parameters: This method accepts two parameters as mentioned above and described below:targetLength: It is the length of the final string once the original string has been padded. If the value is less than the original string length, then the original string is returned.padString: It is the string that is to be padded with the original string. If this value is too long to be within the targetLength, it is truncated.Return Value: It returns the final string that is padded with the given string of the given length. Example 1: This example uses the padEnd() method to pad strings into another string. JavaScript // Function to implement padEnd method function padStrings() { // Input methods exString = "Hello"; exString2 = "Geeks"; // Implement padEnd methods to add symbols at end output = exString.padEnd(12, "$"); output2 = exString2.padEnd(12, "Geeks"); // Display output console.log(output); console.log(output2); } // Function call padStrings() OutputHello$$$$$$$ GeeksGeeksGe Example 2: This example uses the padEnd() method to pad numbers into another number. JavaScript // Function to implement padEnd method function padNumbers() { // Input numbers exNumber = 1234; exNumber2 = 99; // Implement padEnd output = String(exNumber).padEnd(8, "0"); output2 = String(exNumber2).padEnd(8, "**"); // Display output number console.log(output); console.log(output2); } // Function call padNumbers() Output12340000 99****** Supported Browsers: The browser supported by the padEnd() method are listed below:Google Chrome 3Microsoft Edge 12Mozilla Firefox 3.0Safari 5Opera 10.5 Comment S sayantanm19 Follow 1 Improve S sayantanm19 Follow 1 Improve Article Tags : JavaScript Web Technologies javascript-string JavaScript-Methods Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)9 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like