518
\$\begingroup\$

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with , and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of Wikipedia (the Wikipedia entry has been deleted but there is a copy at archive.org ), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

  • Each submission must be a full program.
  • The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.
  • The program must not write anything to STDERR.
  • If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

    Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

  • Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
  • This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".
  • If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:

## [><>](https://esolangs.org/wiki/Fish), 121 bytes

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();
    
    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
21
  • 4
    \$\begingroup\$ @isaacg No it doesn't. I think there would be some interesting languages where it's not obvious whether primality testing is possible. \$\endgroup\$ Aug 28, 2015 at 13:56
  • 7
    \$\begingroup\$ If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? \$\endgroup\$ Aug 28, 2015 at 15:33
  • 2
    \$\begingroup\$ @mbomb007 Well it's hidden by default because the three code blocks take up a lot of space. I could minify them so that they are a single line each, but I'd rather keep the code maintainable in case bugs come up. \$\endgroup\$ Aug 28, 2015 at 19:34
  • 8
    \$\begingroup\$ @ETHproductions "Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge." Publishing the language and an implementation before posting it would definitely be helpful though. \$\endgroup\$ Aug 29, 2015 at 23:01
  • 2
    \$\begingroup\$ @MartinEnder ... Almost. If two BF solutions have the same size, the one with smaller lexicographical order will take smaller number of bytes in Unary. Of course the smallest Unary solution translated to BF is guaranteed to be smallest. \$\endgroup\$
    – DELETE_ME
    May 20, 2018 at 10:20

974 Answers 974

1
8 9
10
11 12
33
4
\$\begingroup\$

Arn, 6 bytes

'Mh└a└

Explanation

Unpacked:

'yt, bs!

A compressed string where every word is capitalized. Output is implicit

\$\endgroup\$
4
\$\begingroup\$

CSS, 62 bytes:

*{display:none}html{display:flex}:after{content:'Hello World!'

This is the first pure CSS on here, I think.

\$\endgroup\$
4
\$\begingroup\$

Sardonyx, 44 bytes

require"stdio"
Stdio:write("Hello, world!")

Sardonyx is a small language created for the repl.it language jam. See the link above for documentation and more!

\$\endgroup\$
4
\$\begingroup\$

Tetr4phobi4, 454 bytes

4OUR
fuor
fuor
4OUR
4OUR
4444
FO44
4OUR
4OUR
4OUR
4OUR
4OUR
fuor
4OUR
4OUR
4OUR
4OUR
4OUR
fuor
4OUR
four
4444
fuor
4OUR
4OUR
4OUR
4OUR
4OUR
4OUR
4OUR
four
4444
4444
fuor
4OUR
4OUR
4OUR
four
4444
FO44
4OUR
4OUR
4OUR
fuor
FOU4
4444
ffff
4OUR
4OUR
fuor
4444
FO44
4OUR
4OUR
4OUR
4OUR
4OUR
fuor
4OUR
4OUR
fuor
FOU4
four
4444
4OUR
4OUR
4OUR
4OUR
4OUR
4OUR
4444
4OUR
fuor
FOU4
four
4444
FOU4
FOU4
fuor
4OUR
4OUR
four
4444
FOU4
FOU4
4444
44UR
fuor
4OUR
four
4444

Ungolfed Code:

{44} H -> 72
4OUR$$$$fuor$$$$fuor$$$$4OUR$$$$4OUR      {44} CELL[1] + 4 * 4 * 4 + 4 + 4
4444                                      {44} Print CELL[1]
FO44                                      {44} Next Cell

{44} e -> 101
4OUR$$$$4OUR$$$$4OUR$$$$4OUR$$$$4OUR      {44} CELL[2] + 4 + 4 + 4 + 4 + 4
fuor$$$$4OUR$$$$4OUR$$$$4OUR$$$$4OUR      {44} CELL[2] * 4 + 4 + 4 + 4 + 4
4OUR$$$$fuor$$$$4OUR$$$$four              {44} CELL[2] + 4 * 4 + 4 / 4
4444                                      {44} Print CELL[2]

{44} l -> 108
fuor$$$$4OUR$$$$4OUR$$$$4OUR$$$$4OUR      {44} CELL[2] * 4 + 4 + 4 + 4 + 4
4OUR$$$$4OUR$$$$4OUR$$$$four              {44} CELL[2] + 4 + 4 + 4 / 4
4444$$$$4444                              {44} Print CELL[2] twice

{44} o -> 111
fuor$$$$4OUR$$$$4OUR$$$$4OUR$$$$four      {44} CELL[2] * 4 + 4 + 4 + 4 / 4
4444                                      {44} Print CELL[2]
FO44                                      {44} Next Cell

{44} , -> 44
4OUR$$$$4OUR$$$$4OUR$$$$fuor$$$$FOU4      {44} CELL[3] + 4 + 4 + 4 * 4 - 4
4444                                      {44} Print CELL[3]

{44} Whitespace -> 32
ffff                                      {44} Reset CELL[3]
4OUR$$$$4OUR$$$$fuor                      {44} CELL[3] + 4 + 4 * 4
4444                                      {44} Print CELL[3]
FO44                                      {44} Next Cell

{44} W -> 87
4OUR$$$$4OUR$$$$4OUR$$$$4OUR$$$$4OUR      {44} CELL[4] + 4 + 4 + 4 + 4 + 4
fuor$$$$4OUR$$$$4OUR$$$$fuor$$$$FOU4      {44} CELL[4] * 4 + 4 + 4 * 4 - 4
four                                      {44} CELL[4] / 4
4444                                      {44} Print CELL[4]

{44} o -> 111
4OUR$$$$4OUR$$$$4OUR$$$$4OUR$$$$4OUR      {44} CELL[4] + 4 + 4 + 4 + 4 + 4
4OUR                                      {44} CELL[4] + 4
4444                                      {44} Print CELL[4]

{44} r -> 114
4OUR$$$$fuor$$$$FOU4$$$$four              {44} CELL[4] + 4 * 4 - 4 / 4
4444                                      {44} Print CELL[4]

{44} l -> 108
FOU4$$$$FOU4$$$$fuor$$$$4OUR$$$$4OUR      {44} CELL[4] - 4 - 4 * 4 + 4 + 4
four                                      {44} CELL[4] / 4
4444                                      {44} Print CELL[4]

{44} d -> 100
FOU4$$$$FOU4                              {44} CELL[4] - 4 - 4
4444                                      {44} Print CELL[4]
44UR                                      {44} Prev Cell

{44} ! -> 33
fuor$$$$4OUR$$$$four                      {44} CELL[3] * 4 + 4 / 4
4444                                      {44} Print CELL[3]

Try it online!

\$\endgroup\$
4
\$\begingroup\$

Kotlin, 33 bytes

fun main()=print("Hello, World!")

This is probably the shortest you can go.

\$\endgroup\$
3
4
\$\begingroup\$

Wierd (Chris's), 125 bytes

-exxxd                         !dlroW ,olleH
 x  xx
 x xxxxc
x
x  x bx  x
x xx  xx  x
xx x   xxxxx
 xx  ax
x    x
x  xxxx
 xx

Try it online

This answer is based on the excellent John's Wierd answer by Dennis.

There are 3 dialects of Wierd: John's (John Colagioia), Milo's (Milo van Handel), and Chris's (Chris Pressey). Chris Pressey presents his JavaScript interpreter as an alternative implementation of John's Wierd, but in fact it is a completely separate dialect no less different from John's Wierd than Milo's Wierd.

Main difference from John's Wierd is the swapped order of x,y arguments for PUTGET command, so letter fetching code around b was altered a bit.

Another difference is the IF command. Chris's Wierd IF behaves as in spec at all times: fall through if TOS is zero (or stack is empty), bounce back otherwise. So before IF at a we need to place 0 on stack with SUB (45° right turn). Also, exiting is different – IP bounces off e when (1,1) is space and program ends at c.

This program relies on the weird behavior of PUTGET command when the stack is empty or has one or two nonzero items. I would expect that PUTGET be a NOP when there are not enough arguments on the stack, but Chris's interpreter puts 32 on the stack in this case. This happens at d and (1,1). This is important for proper exiting.


Wierd commands:

Wierd commands

\$\endgroup\$
4
\$\begingroup\$

Minecraft 1.16, 36 bytes

Just something I thought of :D

/tellraw @a {"text":"Hello, World!"}

I can't find a try it online for these though

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You should be able to just use "Hello, World!" \$\endgroup\$ Jun 14, 2021 at 2:29
4
\$\begingroup\$

GotoOutput, 33 bytes

 Goto Hello,\_World!
Hello,\_World!

A less trivial solution which demonstrates the language's intended control flow would be:

 Assign g o
 Goto H
H Goto e
e Goto l
l If l
 GotoFrom g
 \_ l
 Goto l
o If o
 Goto r
 \_ o
 Goto ,
, Goto \_
\_ Goto W
W Assign g d
 Goto o
r Goto l
d Goto !
!

What is GotoOutput?

GotoOutput is a language I just made. Well, I'm actually a bot, so my owner made this language.

Goto (what I'll call it for short) has one way to output (aside from Print and PrintString for debugging, which shouldn't be valid in plain GotoOutput answers). Gotoing prints the destination. If that sounds painful, it is.

For example:

a Goto b
b Goto c
c

This program would print bc. You'll notice every line has a label, which is prefixed and separated by a space. Labels can contain backslash escapes, such as \_ for a space, or \n for a newline (this is important because there's no other way to output).

Goto uses title case operators, as one of its primary inspirations was TI-BASIC. Its only data type is the string, and it has operators like Concat, ConcatString, Tail, Reverse, Match, and OutsideMatch to work with these. It also has \_, \n, and some other escape codes as additional ways to append these characters.

Goto also has variables, which can be accessed with Assign or Copy. They can be used for control flow in If, IfNot, or GotoFrom. Input is taken with Input.

This is just a general overview of the language, but feel free to play around with it or ask me questions if you want to know more about it. This is the official interpreter:

var interpret = (instructions, input, max = Infinity) => {
    var rows = instructions.split("\n").filter(r => r.trim());
    
    var pointers = new Map();
    var variables = new Map();
    
    var back = [];
    var out = [];
    
    var match = (string, match) => {
        var out = "";

        for (var s = 0; s < string.length; s++) {
            if (string.slice(s).startsWith(match)) {
                out += match;

                s += Math.max(match.length - 1, 0);
            }
        }

        return out;
    };

    var outside_match = (string, match) => {
        var out = "";

        for (var s = 0; s < string.length; s++) {
            if (string.slice(s).startsWith(match)) {
                s += Math.max(match.length - 1, 0);

                continue;
            }

            out += string[s];
        }

        return out;
    };
    
    var parse = (string) => {
        var out = "";
        
        var b = 0;
        
        for (var s = 0; s < string.length; s++) {
            if (b) {
                out += ({
                    "_": " ",
                    "t": "\t",
                    "n": "\n",
                    "r": "\r",
                    "f": "\f",
                    "b": "\b"
                })[string[s]] || string[s];
                
                b = 0;
                
                continue;
            }
            
            if (string[s] == "\\") {
                b = 1;
                
                continue;
            }
            
            out += string[s];
        }
        
        return out;
    };
    
    var r;
    
    for (r = 0; r < rows.length; r++)
        pointers.set(rows[r].split(" ")[0], r);
    
    var row, old;
    
    for (r = 0; r < rows.length; r++) {
        row = rows[r].split(" ");
        
        old = r;
        
        if (row[1] == "Goto" && pointers.has(row[2] || ""))
            out.unshift(row[2] || ""), r = pointers.get(row[2] || "") - 1, back.unshift(r + 1);
        if (row[1] == "GotoFrom" && pointers.has(variables.has(row[2] || "") ? variables.get(row[2] || "") : ""))
            out.unshift(variables.has(row[2] || "") ? variables.get(row[2] || "") : ""), r = pointers.get(variables.has(row[2] || "") ? variables.get(row[2] || "") : "") - 1, back.unshift(r + 1);
        if (row[1] == "GoBack")
            r = (back.length < 2 ? 0 : back[1]) - 1, back.shift();
        if (row[1] == "If" && (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") == "")
            r++;
        if (row[1] == "IfNot" && (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") != "")
            r++;
        if (row[1] == "Match")
            variables.set(row[2] || "", match(variables.has(row[2] || "") ? variables.get(row[2] || "") : "", row[3] || ""));
        if (row[1] == "OutsideMatch")
            variables.set(row[2] || "", outside_match(variables.has(row[2] || "") ? variables.get(row[2] || "") : "", row[3] || ""));
        if (row[1] == "Skip")
            r++;
        if (row[1] == "Assign")
            variables.set(row[2] || "", row[3] || "");
        if (row[1] == "Copy")
            variables.set(row[2] || "", variables.has(row[3] || "") ? variables.get(row[3] || "") : "");
        if (row[1] == "ConcatString")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + (row[3] || ""));
        if (row[1] == "Tail")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "").slice(1));
        if (row[1] == "Reverse")
            variables.set(row[2] || "", [...(variables.has(row[2] || "") ? variables.get(row[2] || "") : "")].reverse().join(""));
        if (row[1] == "Concat")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + (variables.has(row[3] || "") ? variables.get(row[3] || "") : ""));
        if (row[1] == "\\_")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + " ");
        if (row[1] == "\\t")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + "\t");
        if (row[1] == "\\n")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + "\n");
        if (row[1] == "\\r")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + "\r");
        if (row[1] == "\\f")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + "\f");
        if (row[1] == "\\b")
            variables.set(row[2] || "", (variables.has(row[2] || "") ? variables.get(row[2] || "") : "") + "\b");
        if (row[1] == "Input")
            variables.set(row[2] || "", input || "");
        
        if (row[1] == "PrintString")
            out.unshift(row[2] || "");
        if (row[1] == "Print")
            out.unshift(variables.has(row[2] || "") ? variables.get(row[2] || "") : "");
        
        pointers.set(row[0], old);
        
        if (!max--)
            throw new RangeError("Hit maximum instruction count during run");
    }
    
    return out.map(parse).reverse().join("");
};

(() => {
    var main = document.getElementById("main");

    var input_0 = document.getElementById("input_0");
    var input_1 = document.getElementById("input_1");
    var input_2 = document.getElementById("input_2");

    input_0.oninput = () => {
        main.removeAttribute("data-thrown");

        try {
            var output = interpret(input_0.value, input_1.value, 200);

            input_2.value = output;
            input_2.rows = (output.match(/\r\n|\n|\r/g) || []).length + 1;
        } catch (info) {
            main.setAttribute("data-thrown", "");

            throw info;
        }
    };

    input_1.oninput = () => {
        input_0.oninput();

        input_1.rows = (input_1.value.match(/\r\n|\n|\r/g) || []).length + 1;
    }
})();
textarea {
    border: 1px solid #a0a0a0;
    display: block;
    margin-bottom: 8px;
    resize: none;
    padding: 6px;
    font-size: 10px;
    line-height: 1.25;
}

textarea:focus {
    border: 1px solid #a0d0f0;
    outline: 1px solid #a0d0f0;
}

#main[data-thrown] textarea:focus {
    border: 1px solid #f09e9e;
    outline: 1px solid #f09e9e;
}
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Goto Output</title>
        
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta charset="utf-8">
    </head>
    <body>
        <section id="main">
            <textarea id="input_0" rows="10" cols="80"></textarea>

            <textarea id="input_1" rows="1" cols="80"></textarea>
            <textarea id="input_2" rows="1" cols="80" readonly></textarea>
        </section>
    </body>
</html>

\$\endgroup\$
4
\$\begingroup\$

PICO-8, 32 bytes

?"h\69\76\76\79, w\79\82\76\68!"

PICO-8 reads code in lowercase, but prints in uppercase. Lowercase letters do exist in P8SCII, but they need to be accessed through escape codes, as demonstrated.

Alternate 32 byte solution, making use of the \* escape code to print the first two l characters:

?"h\69\*2\76\79, w\79\82\76\68!"
\$\endgroup\$
4
\$\begingroup\$

KonamiCode, 12 bytes

^^vv<><>BALS

If this seems cheaty to you, here's another one that actually does the work (168 bytes):

v(^^^^^^^>^^)<<v(^>>^)<<v(^>>^^^^^^^^)<<v(^>>^^^^^^^^)<<v(^>^>^)<<v(^^^^>^^^^)<<v(^^^>^^)<<v(^>^>^^^^^^^^^)<<v(^>^>^)<<v(^>^>^^^^)<<v(^>>^^^^^^^^)<<v(^>>)<<v(^^^>^^^)<<

And here's an annotated version: https://esolangs.org/wiki/KonamiCode/Hello_World

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Welcome to Code Golf, and nice first answer! This looks like a pretty neat language. I might have to check it out! \$\endgroup\$ Nov 11, 2021 at 18:43
4
\$\begingroup\$

Sysfk (darwin64 syscalls), 1192 bytes

>>>>>>>>,[-<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>]>[-<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>]>[-<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>]>[-<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>]>[-<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>]>[-<<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>>]>[-<<<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>>>]>[-<<<<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<|++++>>>++>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>+>>>>>>>>^>>>>>>>>>+++++++++[<++++++++>-].<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>+++++++[<++++>-]<+.<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>+++++++.<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^.|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>+++.<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>+++++++++++[<------>-]<-.<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>++++[<--->-].<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>+++++++++++[<+++++>-].<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>++++++[<++++>-].<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>+++.<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>------.<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>--------.<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>+++++++++++[<------>-]<-.

Don't try it online because it's not there (yet?)

This can definitely be trimmed down, but I'm not an experienced enough brainfuck programmer to do that.

Sysfk is a brainfuck extension which replaces the input and output instructions with instructions to perform syscalls. This program is written for macOS systemcalls (because that's the platform I program on), but I'll make a linux version as soon as I can.

This program executes the write (0x2000004) syscall once for each character in the string "Hello, World!".

>>>>>>>>,                                                            Load the pointer to the target memory buffer
 [-<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>]                      Copy the first byte of the pointer to rsi
>[-<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>]                   Copy the second byte of the pointer to rsi
>[-<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>]                Copy the third byte of the pointer to rsi
>[-<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>]             Copy the fourth byte of the pointer to rsi
>[-<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>]          Copy the fifth byte of the pointer to rsi
>[-<<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>>]       Copy the sixth byte of the pointer to rsi
>[-<<<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>>>]    Copy the seventh byte of the pointer to rsi
>[-<<<<<<<<<<<<<<<|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+^>>>>>>>>>>>>>>>] Copy the eighth byte of the pointer to rsi
<<<<<<<<<<<<<<<|++++>>>++>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>+>>>>>>>>^    Setup the remaining syscall parameters
>>>>>>>>>+++++++++[<++++++++>-].                                     Print 'H'
<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^                                    Reset syscall parameters
>>>>>>>>>+++++++[<++++>-]<+.                                         Print 'e'
<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>+++++++.                     (Reset and) Print 'l'
<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^.                                    (Reset and) Print 'l'
|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>+++.                                 (Reset and) Print 'o'
<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>+++++++++++[<------>-]<-.   (Reset and) Print a comma
<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>++++[<--->-].               (Reset and) print ' '
<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>+++++++++++[<+++++>-].     (Reset and) print 'W'
<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>++++++[<++++>-].           (Reset and) print 'o'
<<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>+++.                        (Reset and) print 'r'
<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>------.                      (Reset and) print 'l'
<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>--------.                    (Reset and) print 'd'
<<<<<<<<|+++>>>++>>>>>>>>>>>>>+^>>>>>>>>>+++++++++++[<------>-]<-.   (Reset and) print '!'
\$\endgroup\$
4
\$\begingroup\$

NLRNIS, 15 bytes

>#Hello, World!

My first TC (?) Programming language.

the interpreter is here

Explanation:

>#Hello, World!"H
>
 #
  Hello, World!   Define # = "Hello, World!"

(implicit output the variable # only)
\$\endgroup\$
4
\$\begingroup\$

CASL II, 55 43 bytes.

CASL II is an assembly language for COMET II, the fictional architecture. It is designed for Japan Information-Technology Engineers Examination.

Here is the page that you can obtain official specification, as Information Technology Terms and Specifications of Programming Languages Used in Examination Questions.

I've found a way to specify a literal instead of an address:

A START
 OUT ='Hello, World!',=13
 RET
 END

Previous version

55 bytes

Z START
 OUT A,B
 RET
A DC 'Hello, World!'
B DC 13
 END

Links (they are in Japanese)

\$\endgroup\$
4
\$\begingroup\$

tinylisp, 40 bytes

(load library
(join(q(Hello, World!))spc

Try it online!

tinylisp, 56 bytes

(string(q(72 101 108 108 111 44 32 87 111 114 108 100 33

Try it online!

Considering tinylisp's lack of strings, this is very likely the best hello world without libraries.

\$\endgroup\$
4
\$\begingroup\$

dotcomma, 494 bytes

[[[[[[[[[[[[[[[[[[[.][.].,][,.].,][,.].,][,.].,][,.].,][.].,][.][.][.][.][.][.][.][.][.][.][.].,][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.].,][.][.][.][.][.][.][.][.][.][.][.][.][.][.][.].,][.][.][.][.][.][.][.][.][.][.][.][.][.].,][.].,][.][.][.][.][.][.][.].,],],][.][.][.].,],][.][.][.].,][,][[,.][[[,][,][,][[,.][[[,][[,.][[[,][,][,][,][[,.][[[,][,][,][,][,][,][,][[,.][[[,][,][,][,][[,.][[[,][,][,][,][[,.][[[,]]].,]]].,]]].,]]].,]]].,]]].,]]].,]]

Dotcomma is a language I made, designed to do as much as possible with the fewest instructions. Interestingly, it uses a queue rather than a stack. The final state of the queue is used as output.

I've put a high level explanation below, but even I don't fully understand how I got this to work :p

The easy part was generating all the necessary letters, ordered by code point ( !,HWdellloor):

First, it generates the code point for a space (32): [[[[[[.][.].,][,.].,][,.].,][,.].,][,.].,]. Then, it wraps that in a number of [<n> [.]* .,] blocks, which increment the value and adds it to the queue, with the number of [.]s being the amount it increments

Then it needs to sort the queue so that it displays in the correct order (Hello, World!):

Without an accumulator or second queue, this is difficult. The workaround is to use the execution order to read a value, perform an operation that modifies the queue, then add the result (0) to the previously read value. This re-adds the value into the queue, at the end. If the operation performed is a shift, the stored value can be placed anywhere into the queue. Working backwards from ! to , it will shift the queue with a number of [,]s. The temporary addition-based storage is implemented as [[,.] [[ <previous letter> ]] .,]. Importantly, this is nested in a way that each time it does this is returns 0 so it won't mess up the rest. Luckily, after the , is shifted, Hello is already in order.

\$\endgroup\$
4
\$\begingroup\$

Coq, 20 30 bytes

Check"Hello, World!".

TRYITONLINE

But you have to first define what string is using this bit of code:

Require Import Coq.Strings.String.
Declare Scope string_scope.
Delimit Scope string_scope with string.
Bind Scope string_scope with string.
Local Open Scope string_scope.
Register string as core.string.type.
Register EmptyString as core.string.empty.
Register String as core.string.string.

And i think this is probably the shortest answer.

\$\endgroup\$
4
\$\begingroup\$

Tarfish, 160 bytes

x++++++++++++++++++++++++++++++++:+:+++++++++++:++++++++++++++++++++++++++++:.+++++++++++++++:++++++++++++++:.+++++++:::..+++:.{{{.{.{{.}}.:++++++.:.--------..;

Try It Online!

Tarfish is an esolang of mine that is a more tarpit-style version of ><>. This answer doesn't really use that much of its 2D features, but it works.

Note: a single + or - means multiple, I'll specify how many. After each line is a visualisation of the stack as characters.

x                                             # Push a 0 - [0]
 +                                            # Increment to 32 - ' '
  :+                                          # Duplicate and increment - ' !'
    :+                                        # Duplicate and increment to 44 - ' !,'
      :+                                      # Duplicate and increment to 71 - ' !,H'
        :.                                    # Duplicate and output - ' !,H'
          +:                                  # Increment to 87 and duplicate -  ' !,WW'
            +:.                               # Increment to 101, duplicate and output - ' !,We' 
               +:::..                         # Increment to 108, quadruple and output twice - ' !,Wll' 
                     +:.                      # Increment to 111, duplicate and output - ' !,Wlo'
                        {{{.                  # Cycle right three times to the comma and output - 'Wlo !'
                            {.                # Cycle right once to the space and output - '!Wlo'
                              {{.             # Cycle right twice to the W and output - 'lo!'
                                 }}.          # Cycle left twice to the o and output - '!l'
                                    :+.       # Duplicate, increment to 114 and output - '!l'
                                       :.-    # Duplicate, output, and decrement to 100 - '!d'
                                          ..; # Output twice and halt
\$\endgroup\$
4
\$\begingroup\$

flax C, 14 bytes

"Hello, World!

The first answer to use flax.

Explanation

The program is a niladic chain, which means it does not take any arguments.

Even though "Hello, World! looks like a string, in flax it is represented as numbers in ASCII. Hence we need the C flag to print as characters instead of numbers.

\$\endgroup\$
2
  • 5
    \$\begingroup\$ @Downvoter explain yourself please. \$\endgroup\$
    – zoomlogo
    Feb 19, 2022 at 11:07
  • 1
    \$\begingroup\$ Downvote was likely because it's a trivial answer, but like...HW basically exists to catalog Hello, World! programs, most of which are trivial, so that's a bit of a sussy baka move whoever did it. \$\endgroup\$ May 30, 2022 at 3:42
4
\$\begingroup\$

Scratch, 33 bytes

when gf clicked
say[Hello, World!

enter image description here

\$\endgroup\$
4
\$\begingroup\$

Flobnar, 34 bytes

Hello, World!�
:> v:
g|\@>!,
00> +

Try it online!

(Previous record: 41)

The last character at the end of the first line is the null character \0.

@    Start the program

  :  :
\ >!,g    Initially n (top of stack) = 0.
> +  0    Print the char at (n, 0), push n+1, and evaluate the left of \:

:> v
g|\@    If the char at (n, 0) is zero, evaluate to zero;
00      otherwise go to the start of the program with updated n
\$\endgroup\$
4
\$\begingroup\$

Grocery List, 98 79 bytes

H

w
nnn
d
c
c
z
f
v
d
v
l
v
r
v
o
v
W
n
b
s
v
X
nn
d
v
o
v
l
c
v
e
v
H
l
p
e
t

Save in a file then use this Python interpreter to run the specified program.

\$\endgroup\$
4
  • \$\begingroup\$ Could you please link to the interpreter you used to test this? \$\endgroup\$
    – Dennis
    Jan 2, 2019 at 12:34
  • \$\begingroup\$ From the challenge spec: Note that there must be an interpreter so the submission can be tested. The only interpreter I know of is this one, but your program just prints H in it. \$\endgroup\$
    – Dennis
    Jan 2, 2019 at 12:59
  • \$\begingroup\$ fixed, but space can't print \$\endgroup\$
    – u-ndefined
    Jan 2, 2019 at 13:29
  • \$\begingroup\$ The output looks fine now, but the program seems to exit by popping from an empty stack and the challenge says The program must not write anything to STDERR. \$\endgroup\$
    – Dennis
    Jan 2, 2019 at 13:40
4
\$\begingroup\$

Acc!!, 122 bytes

Due to limitations of the scoreboard snippet, the title of this post is incorrect. The correct name of this language is Acc!! with italics.

108
Write 72
Write 101
Write _
Write _
Write 111
Write 44
Write 32
Write 87
Write 111
Write 114
Write _
Write 100
Write 33

The first line stores 108 (char code for l) in the accumulator. The rest writes Hello, World! one character at a time, with _ referencing the accumulator value. Using the accumulator beats the straightforward version by 2 bytes. :^)

Works the same in Acc!.

\$\endgroup\$
3
  • \$\begingroup\$ @quartata Thanks for the edit, but italics in the language name breaks the scoreboard. \$\endgroup\$
    – DLosc
    Jan 20, 2016 at 22:56
  • \$\begingroup\$ Ah. Sorry, didn't realize :P \$\endgroup\$ Jan 20, 2016 at 23:45
  • \$\begingroup\$ Maybe the scoreboard snippet should be updated. \$\endgroup\$
    – mbomb007
    Jan 22, 2016 at 17:58
4
\$\begingroup\$

TalkingHead, 11 seconds

The first sound based programming language!!!

Sound File

\$\endgroup\$
4
  • 5
    \$\begingroup\$ 1. You can probably shave a couple seconds by talking faster. 2. You should probably use the byte count of the outputted audio file as your score. 3. This isn’t the first replant based on audio—There are several others, though I can’t find them at the moment. \$\endgroup\$
    – noodle man
    May 28, 2023 at 20:45
  • \$\begingroup\$ @Jacob i used a computer-generated voice. \$\endgroup\$ May 29, 2023 at 8:52
  • \$\begingroup\$ Ah, I hadn’t listened to the audio file yet haha. But I bet you could speed up the audio file and it would still work \$\endgroup\$
    – noodle man
    May 29, 2023 at 13:03
  • 2
    \$\begingroup\$ I had a similiar idea earlier, youve inspired me to keep working on it :P \$\endgroup\$
    – Seggan
    May 29, 2023 at 23:25
4
\$\begingroup\$

32 bit SPARC machine language on SunOS, 48 45 bytes

0x00:  40 00 00 02    call 0x8            ! PC relative jump, return addr to %o7
0x04:  82 10 20 04    mov  4, %g1         ! delay slot; select write() syscall
0x08:  90 10 20 01    mov  1, %o0         ! stdout is fd=1
0x0c:  92 03 E0 20    add  %o7, 32, %o1   ! put addr of string in %o1
0x10:  94 10 20 0d    mov  13, %o2        ! length of string
0x14:  91 D0 20 08    ta   %icc, %g0 + 8  ! call write()
0x18:  82 10 20 01    mov  1, %g1         ! select exit() syscall
0x1c:  91 D0 20 08    ta   %icc, %g0 + 8  ! call exit()
0x20:  48 65 6c 6c    "Hello, World!"
       6f 2c 20 57
       6f 72 6c 64
       21

Porting to 64 bit SPARC requires changing the argument of the trap instruction from 8 to 64.

To try this on a SunOS machine, compile and run the following C program.

const char main[]="\x40\x00\x00\x02\x82\x10\x20\x04\x90\x10\x20\x01\x92\x03\xe0\x20\x94\x10\x20\x0d\x91\xd0\x20\x08\x82\x10\x20\x01\x91\xd0\x20\x08Hello, World!";

EDIT: To try this on Linux (for SPARC), change the argument of the trap instruction to 16 for 32 bit mode and 109 for 64 bit mode.

\$\endgroup\$
4
\$\begingroup\$

Minecraft Function, 26 bytes

tellraw @a "Hello, World!"
\$\endgroup\$
1
  • \$\begingroup\$ Also a shorter solution with a one character username seems a bit like cheating, since it'll only work for players with that (very rare) username. \$\endgroup\$
    – LostXOR
    Aug 4, 2023 at 14:26
4
\$\begingroup\$

Rec, 47 46 bytes

Saved a byte thanks to bsoelch

72p101p108 0:0:pp111p44p32p87p111p114pp100p33p

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Welcome to the site, nice to see a new language here \$\endgroup\$
    – mousetail
    Aug 4, 2023 at 14:00
  • \$\begingroup\$ You can use dup to save 1 byte: 72p101p108 0:0:pp111p44p32p87p111p114pp100p33p \$\endgroup\$
    – bsoelch
    Aug 4, 2023 at 14:04
4
\$\begingroup\$

Vyxal 3, 8 bytes

"Ḍᵗ{w<ᵏ”

Try it Online!

Vyxal 3 just dropped.

\$\endgroup\$
7
  • \$\begingroup\$ actual golflang developer \$\endgroup\$ Nov 22, 2023 at 1:24
  • \$\begingroup\$ did you remove the Hello, World builtin lol \$\endgroup\$
    – noodle man
    Nov 22, 2023 at 2:23
  • \$\begingroup\$ @noodleman it hasnt been added yet \$\endgroup\$
    – lyxal
    Nov 22, 2023 at 2:27
  • \$\begingroup\$ @noodleman this has been fixed \$\endgroup\$
    – lyxal
    Nov 22, 2023 at 12:00
  • \$\begingroup\$ Has the fix been pushed yet? The links on the README still don't work. \$\endgroup\$
    – noodle man
    Nov 22, 2023 at 12:31
3
\$\begingroup\$

LOLCODE, 22 bytes

VISIBLE"Hello, World!"

Works in interpreters that don't require the presence of HAI and KTHXBYE.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Agh! Posted a minute before me :P \$\endgroup\$
    – Kade
    Aug 28, 2015 at 13:57
  • \$\begingroup\$ @Shebang Gotta go fast! \$\endgroup\$
    – Fatalize
    Aug 28, 2015 at 13:57
  • \$\begingroup\$ damn I'm a few days to late :( \$\endgroup\$ Sep 1, 2015 at 11:54
  • 2
    \$\begingroup\$ And I pronounce this code, Ungolfable! \$\endgroup\$ Jun 4, 2016 at 13:01
3
\$\begingroup\$

Wheat, 32 Bytes

Wheat is an esolang that is based on outputting and inputting. Only what has been output on a previous cycle can be input on the current one. The buffers last only one cycle; if the data of previous cycle is not read on current cycle, on the next cycle it can not be accessed, it will all be erased, replaced by the output of the current cycle (if any, otherwise the empty string is used).

output "Hello, World!"
terminate
\$\endgroup\$
1
  • 1
    \$\begingroup\$ The description of Wheat that you gave is taken directly from the Wheat esolang page. Care to cite? \$\endgroup\$ Jan 21, 2018 at 6:41
3
\$\begingroup\$

Gibberish, 17 Bytes

Surprisingly, the shortest answer I could make is not gibberish at all.

[Hello, World!]eo
\$\endgroup\$
1
8 9
10
11 12
33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.