452
\$\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\$
  • 2
    \$\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\$ – Martin Ender Aug 28 '15 at 13:56
  • 6
    \$\begingroup\$ If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? \$\endgroup\$ – aditsu quit because SE is EVIL Aug 28 '15 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\$ – Martin Ender Aug 28 '15 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\$ – Martin Ender Aug 29 '15 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\$ – user202729 May 20 '18 at 10:20

803 Answers 803

1
6 7
8
9 10
27
4
\$\begingroup\$

Bubblegum, 11 bytes

0000000: 15 27 4d 50 62 a9 9a 29 6b 6d e2  .'MPb..)km.

Although technically Turing complete, Bubblegum was made for constant-output challenges.

Try it online!

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

COBOL, 65 Bytes

PROGRAM-ID.H.PROCEDURE DIVISION.DISPLAY 'Hello, World!'.STOP RUN.

Just from what I remember. Probably doesn't work but I can't tell since my machines set up to run COBOL are long-gone.

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Welcome to the site! \$\endgroup\$ – James May 25 '17 at 15:39
  • \$\begingroup\$ This works just fine with GNU COBOL assuming you set the -F (or -free) flag, but you're missing a comma in your string. tio.run/##S85Pys/RTc8r/f8/… \$\endgroup\$ – Dennis Jul 17 '17 at 20:52
  • \$\begingroup\$ So I am. I shall fix this. \$\endgroup\$ – Bakna Jul 17 '17 at 20:53
  • \$\begingroup\$ You can save 10 bytes: PROGRAM-ID.H.PROCEDURE DIVISION.DISPLAY'Hello, World!'. \$\endgroup\$ – SirBogman Jul 21 at 22:03
4
\$\begingroup\$

,,,, 14 bytes

"Hello, World!

I finally added unclosed strings to ,,,. Took me long enough.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

ZT, 199 bytes

The ZT programming language is quite romantic: it features little data couples (Romeos & Juliets). ZT program flow is diagonal and commands are defined only by program flow.

The webpage is at:

It has a link to is an interpreter at:

But that interpreter is broken and doesn't do jumps correctly. The website also has a link to a self extracting archive containing the documentation, the interpreter and some examples:

And that interpreter works so that's the one you need to use to test this.

I am not too confident that this is the smallest possible Hello World but it is much smaller than the one published on the website. If you have comments for golfing it please let me know.

48<>ZT<>ZT<>...>
<<ZT<>ZT<>ZT.<06
ZT<>ZT<>6F<>6C<<
<<ZT<>ZT<>ZT><03
ZT<>ZT<>20<>72<<
<>ZT<>ZT<>ZT><05
...>65<>6F<>57<<
.>ZT<>ZT<>ZT><05
....64<>6C<>2C<<
....<>ZT<>ZT><05
........21>.6C<
........<...>
| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Numberwang, 77 bytes

69696969696969693696969623673363316969696968359533059595636969663633563583193

Try it online!

Just incrementing and decrementing the pointer by certain amounts.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ [Brainfuck translation, 72](220200949409153121212000717002230663002330030931131130003633113112300093) \$\endgroup\$ – ASCII-only Apr 14 '18 at 7:36
4
\$\begingroup\$

Sqirrel - Peter, 903 bytes

A couple notes about my golfing:

  • The examples have punctuation at the end of sentences but the spec doesn't say that it should be there so I left it off.
  • The spec says The request consists firstly of the text "I wish I had a " then is followed by a thing. and list of the variable-things you can use: ... an Apple which is inconsistent so I used "I wish I had a Apple" because it is shorter.
  • The spec says Here is [nr] [thing][s] Set the var to NR. Add an 's' if needed and even though the examples use Fishes the only ones that should be valid are Fish and Fishs and I chose Fish because I don't think it needs to be plural and it is shorter.
  • There is an exit command but the spec doesn't say what happens if the flow reaches the end of the text so I am assuming the program ends and I didn't use the exit command.

Here is my attempt:

I wish I had a Fish
Here is 72 Fish
I wish I had a Fish
Now everyone has it
I wish I had a Fish
Here is 101 Fish
I wish I had a Fish
Now everyone has it
I wish I had a Apple
Here is 108 Apples
I wish I had a Apple
Now everyone has it
I wish I had a Apple
Now everyone has it
I wish I had a Forrest
Here is 111 Forrests
I wish I had a Forrest
Now everyone has it
I wish I had a Fish
Here is 44 Fish
I wish I had a Fish
Now everyone has it
I wish I had a Fish
Here is 32 Fish
I wish I had a Fish
Now everyone has it
I wish I had a Fish
Here is 87 Fish
I wish I had a Fish
Now everyone has it
I wish I had a Forrest
Now everyone has it
I wish I had a Fish
Here is 114 Fish
I wish I had a Fish
Now everyone has it
I wish I had a Apple
Now everyone has it
I wish I had a Fish
Here is 100 Fish
I wish I had a Fish
Now everyone has it
I wish I had a Fish
Here is 33 Fish
I wish I had a Fish
Now everyone has it
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ If I count correctly, that's 66 more bytes for the version with correct punctuation and grammar. I.e. an apple, 100 fishes, etc. and a dot at the end of each line. \$\endgroup\$ – Cœur Aug 24 '17 at 13:15
4
\$\begingroup\$

ADJUST, 281 bytes

 ;I-      &  e$      &  m-        &  g2Ph$      &  a2$      &  n$      &  e2+-      &  g2Ph$      &  OPh$      &  m-      &  e-      &  n-
}     AgR};      AgR};      A=AgR};         AgR};       AgR};      AgR};        AgR};         AgR};        AgR};      AgR};      AgR};      AC

Try it online!

Diagonal }; turn IP right. I-, e$, m-, etc. create ascii code in the accumulator and push it on both stacks. A print char. gR};& move IP to the first line. = swap stacks. C exit.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Japt, 15 14 11 bytes

(using the ISO/IEC 8859 character encoding)

Japt is a shortened version of JavaScript. Interpreter

`HÁM, Wld!

There's an unprintable char in there, so here's a hexdump:

60 48 C1 4D 2C 20 57 8E 6C 64 21
`  H  Á  M  ,     W  .  l  d  !

Recently, @Vɪʜᴀɴ has helped me add in the shoco library for compressing strings. Using backticks around a string tells the interpreter to automatically decompress the string, and when a backtick is needed at the end of a program, you can leave it off. Thus, Japt now beats or ties all languages that don't have some sort of built-in to obtain "Hello, World!". (Including Pyth :D)

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

095, 16 bytes

'Hello, World!'s

First answer in my attempt at making a programming language! Pushes Hello, World! to the stack and then prints.

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Welcome to PPCG! \$\endgroup\$ – Erik the Outgolfer Jan 25 '18 at 20:43
4
\$\begingroup\$

Atari Logo, 21 bytes

Code:

PRINT [HELLO, WORLD!]

Result:

enter image description here

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Brainfuck, 128 bytes

Generated using this generator, which is sub-optimal.

-[------->+<]>-.-[->+++++<]>++.+++++++..+++.[->+++++<]>+.------------.---[->+++<]>.-[--->+<]>---.+++.------.--------.-[--->+<]>.
| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

ELVM-IR, 116 68 66 65 bytes

.data
.string"Hello, World!"load B,A
putc B
add A,1jne 0,A,13exit

Thanks to @ASCII-only for golfing off 48 50 51 bytes!

Try it online!

Background

Running the above program with eli <file> interprets it, but elc -<target> <file> is where the real magic happens: it translates ELVM-IR source code to any of the supported backends!

Try it online!

The ELVM toolchain also supports compiling (a subset of) C and its standard library to ELVM-IR.

Try it online!

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Nikud, 672 bytes

ֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֱֲֳֳֳֳֳֳֳֳֳֳֳֳֳֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶֶַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַַָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָָ

Try it online

Even though it has tons of bytes, it's top 3 in width, as all the characters are diacritical marks.

There isn't much useful to explain. The character codes are put in reverse order into the stack using mostly אֱ (push 1), אֶ (dup) and אַ (add). Then אֵ (print as char) is called 13 times.

Another thing that adds to the byte count is that each character is represented by 2 bytes in UTF-8. So it's actually 336 characters.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I think this can be golfed more using multiplication. \$\endgroup\$ – Windmill Cookies Jun 14 '18 at 5:17
4
\$\begingroup\$

axo, 22 bytes

"!dlroW ,olleH"[>[(#<\

Try it online!

Pushes "Hello, World!" to the stack "!dlroW ,olleH"

Duplicates top of stack afterward, which results in "HHello, World!" [

Moves to the right >.

Duplicates it again, which results in "HHHello, World!" [

Outputs "H" while popping from the stack, so the stack is "HHello, World!" (

Pops the top of the stack, results in "Hello, World!" #

Moves left <

Pops the top of the stack, results in "ello, World!" #

Outputs "e" while popping from the stack, which results in STDOUT being "He" and the stack being "llo, World!" (

Duplicates the top of the stack, resulting in the stack being "lllo, World!" [

Moves right. >

And I'm sure you can figure out the rest. If you can't, I'll update a more indepth-explanation soon.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

A Pear Tree, 25 bytes

print'Hello, World!'#»G²Ú

Try it online!

A Pear Tree programs are written in an arbitrary ASCII-consistent 8-bit character set; for codepoint 128 and above, the interpreter cares about the codepoint numerically, not the represented character. TIO uses Latin-1, so the above program is actually a Latin-1 decoding of the codepoints that make it up.

Explanation

print'Hello, World!' should be fairly self-explanatory. However, there is some choice available here; print"Hello, World!" would have been the same length, but leads to the resulting checksum being less printable.

The checksum is the interesting part of the program. In this program, that's the #»G²Ú at the end. For golfing, you'd want the shortest workable checksum, which is normally 4 or 5 bytes long. (It's a 32-bit checksum, so 4 bytes would normally be enough, but the checksum is also executed as code, and thus needs to be a valid command; the # starts a comment, so # plus 4 bytes is normally enough to add a checksum to anything.) The checksum doesn't have to cover the whole code, but does have to cover a prefix of the part of the code that actually runs; adding comments at the end is terser than adding them at the start, and we want to execute the entire program, so for this program, I caused the checksum to cover the entire program.

Although a Hello World program doesn't benefit much from the checksumming, we could have made use of the checksum behaviour to embed the Hello World program into a larger document or write multiple copies of the program so that if one gets corrupted, the others can still run. This makes A Pear Tree considerably more robust than most languages are.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

]=[, 164 bytes

[=======[==]]=[[=[[=]]=[[=[[========]]][]=[]=[[=[=[=]]][]=[[====[====]]=[[===[==]]=[[========[=======]]=[]=[[=[=[====]]=[[=[[========]]=[[=[[]]=[[===[===]]=[[=[]]=[

]=[ was a language which only uses the symbols ], =, and [.

The ]=[ interpreter is written in 12-Basic.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ There's something amusing about the fact that the ]=[ interpreter at the link is written in the 12-basic interpreter. \$\endgroup\$ – snail_ May 31 '18 at 20:18
  • \$\begingroup\$ Permalink no longer works \$\endgroup\$ – ASCII-only Dec 26 '18 at 1:07
  • \$\begingroup\$ now I can't find the interpreter... \$\endgroup\$ – 12Me21 Dec 28 '18 at 3:18
  • \$\begingroup\$ I was looking through some old files and I found the interpreter, finally. \$\endgroup\$ – 12Me21 Mar 13 '19 at 21:32
4
\$\begingroup\$

Bootable x86 machine code, 512 bytes

Hexdump:

31 c9 8e d9 be 10 7c b1  0d ac b4 0e cd 10 e2 f9  |1.....|.........|
48 65 6c 6c 6f 2c 20 57  6f 72 6c 64 21 00 00 00  |Hello, World!...|
*
00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|

* represents 464 bytes of padding required to place the bootable flag (55 aa) at offset 510.

This is the same as the following assembler code, which can be assembled using nasm hello.asm -f bin -o hello.bin, assuming the assembler code is in a file called hello.asm

[ORG 0x7C00]
[BITS 16]

    xor cx, cx      ; Set cx to 0
    mov ds, cx      ; Set ds to cx (0)
    mov si, msg     ; Set si to the address of the message
    mov cl, 13      ; Set cx to 13 (the size of the message)
print_loop:         ; For each character in the message:
    lodsb           ;   Set al to the character
    mov ah, 0x0E    ;   Set ah to 0x0E
    int 0x10        ;   Call interrupt 0x10 (video services) with ah set to 0x0E (print al to screen)
    loop print_loop ;   Decrement cx and continue the loop if cx > 0

msg:
    db 'Hello, World!' 

times 510 - ($-$$) db 0
db 0x55
db 0xAA

Running

The code can be runned with QEMU using the following command, assuming the binary code is saved in a file called hello.bin:

qemu-system-x86_64 -drive format=raw,file=hello.bin
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Can you assume that regs like cx are already cleared? \$\endgroup\$ – ceilingcat May 7 '19 at 5:32
4
\$\begingroup\$

strict, 18 bytes

out: Hello, World!

Believe it or not, the space is required (hence the language name). In case the website dies, here's the interpreter download link.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Triangular, 55 bytes

6\6+@*8\C::6--::@\@#2"+3^82*@3/#-<*#+/@"#+F<3/3@@#-7:*<

This one took a while. Also will be very difficult to golf, since there is zero no-ops in it, meaning you'll have to save 10 bytes to get it to a size 9 triangle in order to save any bytes

This expands out into this size 10 triangle:

         6
        \ 6
       + @ *
      8 \ C :
     : 6 - - :
    : @ \ @ # 2
   " + 3 ^ 8 2 *
  @ 3 / # - < * #
 + / @ " # + F < 3
/ 3 @ @ # - 7 : * <

How it works

Note: this ignores all control flow characters and just looks at what gets run in order

66* Push 36
:: Duplicate it twice
2*# Output H, popping it
3*  Multiplies by 3, yielding 108
:   Duplicates
-7# Outputs e, popping it
@@  Outputs l twice, without popping it
3+@ Outputs o, without popping it
" Swaps, putting 36 at the top of the stack
:: Duplicates it twice
8+@  Outputs comma, without popping
C-#  Outputs space, popping the top of the stack
2*F+# Outputs W, popping it
"     Swaps back around, putting 111 at the top of the stack
@     Outputs o, without popping
3+@   Outputs r, without popping
6-@   Outputs l, without popping
8-#   Outputs d, whilst popping
3-@   Subtracts 3 from 36, giving !, and outputs it
6     Pushes 6, which does nothing

Try it Online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Rearranging the structure, I can get you 3 no-ops, though really it's only one byte TIO. Only 7 more to go! \$\endgroup\$ – Jo King Aug 25 '19 at 21:40
  • \$\begingroup\$ 2 more. Halfway there. \$\endgroup\$ – Jo King Aug 25 '19 at 21:50
  • \$\begingroup\$ Ok, I've got all the characters onto the stack in a size 9 triangle, but I dont have any space to put a loop to print all of them. Maybe could be golfed slightly more to fit it in TIO \$\endgroup\$ – EdgyNerd Aug 26 '19 at 6:10
4
\$\begingroup\$

EBCDIC Punched Card, 13 bytes

enter image description here

Disk Operating System/360, also DOS/360, or simply DOS, is a discontinued operating system for IBM mainframes. It was announced by IBM on the last day of 1964, and it was first delivered in June 1966.In its time, DOS/360 was the most widely used operating system in the world.

A typical configuration might consist of a S/360 model 30 with 32KB memory and the decimal instruction set, an IBM 2540 card reader/card punch, an IBM 1403 printer, two or three IBM 2311 disks, two IBM 2415 magnetic tape drives, and the 1052-7 console.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Pxem, 0+17=17 bytes

Using the filename as data without counting the length is cheating. Therefore it is 17 bytes. (It even uses the filename extension as part of the program!)

Save the program as

Hello, World!.pxe

and the file contents should be empty.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You know, just testing Feeds... \$\endgroup\$ – user85052 Jan 10 at 4:07
4
\$\begingroup\$

Verbosity v2, 152 bytes

IncludeTypePackage<OutputSystem>
IncludeTypePackage<StringArray>
outpu=OutputSystem:NewOutput<DEFAULT>
OutputSystem:DisplayAsText<outpu;"Hello, World!">

Try it online!

Introducing Verbosity v2! This is a short as it gets, as variable names must be 5 characters or more. The ungolfed version isn't much different:

IncludeTypePackage<OutputSystem>
IncludeTypePackage<StringArray>

output = OutputSystem:NewOutput<DEFAULT>

OutputSystem:DisplayAsText<output; "Hello, World!">

Try it online!

And it's pretty obvious how it works.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Ada, 68 bytes (-15)

Noticed there wasn't a plain Ada answer yet, only one with GNAT, so I made one:

with Text_IO;procedure H is
begin
Text_IO.Put("Hello, World!");end;

Thanks to 3D1T0R and breadbox for improving this!

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I'm not all that familiar with Ada, but took a swing at 'golf'ing this down a bit. Please evaluate: ideone.com/JjmhIt 75 bytes. \$\endgroup\$ – 3D1T0R May 29 '18 at 19:31
  • 1
    \$\begingroup\$ Also note that the Ada. can be dropped (both places) to save 8 bytes. \$\endgroup\$ – breadbox May 29 '18 at 21:20
  • 1
    \$\begingroup\$ Wow, somebody replied to this over a year later! You can combine 3D1T0R's golf with breadbox's tip to golf it down quite a bit. \$\endgroup\$ – python-b5 May 30 '18 at 20:25
  • \$\begingroup\$ @breadbox: I could have sworn I tried that, but apparently not. I kind of doubt this can be golfed much more. \$\endgroup\$ – 3D1T0R May 31 '18 at 21:22
  • \$\begingroup\$ TIO link pls \$\endgroup\$ – ASCII-only Dec 26 '18 at 1:02
4
\$\begingroup\$

Keg, 15 8 bytes

«H%c¡|,!

Try it online!

Wow. It's been a while since I posted this. And boy oh boy how Keg has changed.

Explained

« #Start a special compressed string
H% #String compression code (SCC) for "Hello"
c¡ #SCC for "World"
|,! #Join "Hello" and "World" with a `,` and `!` to create "Hello, World!"
« #Close the special compressed string and implicitly print

Old Program

Hello\, World\!

Keg is a newly created stack-based, golfing language, which focuses on only having symbols as functions and keywords. As such, alphanumeric characters are pushed to the stack as letters (even spaces are pushed, meaning that they aren't NOPs).

Symbols that would normally be commands can be escaped using \'s.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Poetic, 324 bytes

the i/o case of HELLO
a good i/o drill is:say a HELLO
i said HELLO,saying it in Poetic
i code in Poetic,a good way to write a poem
a special piece for you
a special piece in machine writing for you
i already think i do pretty well writing for the machine poem
Poetic program syntax is nice
a perfect sorta poem and a program

Try it online!

This is nothing original, it's a straight port of the brilliant brainfuck answer from @KSab...but it turns out that it's the shortest representation of Hello, World! that I can find in Poetic. If anyone can golf this, please let me know; I'm definitely interested if someone can beat this solution!

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Intcode, 201 bytes

72,4,0,-1,1101,1,100,3,4,3,1101,100,8,3,4,3,4,3,1101,100,11,3,4,3,1101,40,4,3,4,3,1101,30,2,3,4,3,1101,80,7,3,4,3,1101,100,11,3,4,3,1101,100,14,3,4,3,1101,100,8,3,4,3,1101,98,2,3,4,3,1101,30,3,3,4,3,99

And this kids is why we don't golf using languages made up for programming competitions.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ mmm undefined behavior \$\endgroup\$ – Unrelated String Dec 5 '19 at 6:31
  • \$\begingroup\$ Invalid opcodes are just NOPs in my interpreter \$\endgroup\$ – Lyxal Dec 5 '19 at 6:33
  • \$\begingroup\$ @UnrelatedString I mean, they haven't said what to do with undefined ops \$\endgroup\$ – Lyxal Dec 5 '19 at 6:34
  • \$\begingroup\$ Outgolfed \$\endgroup\$ – pppery Dec 27 '19 at 2:19
4
\$\begingroup\$

Plain English 901 308 bytes:

To run:
Start up.
Put "Hello, World!" in a b buffer.
Call "kernel32.dll" "GetStdHandle" with -11 returning a h number.
Call "kernel32.dll" "WriteFile" with the h
and the b's first and the b's length
and a r number's whereabouts and 0 returning the r.
Call "kernel32.dll" "CloseHandle" with the h.
Shut down.

ungolfed, with comments and error traps:

To run:
  Start up.
  Put "Hello, World!" in a buffer.
  Write the buffer to stdout.
  Shut down.

To write a buffer to stdout:
  Clear the i/o error.
  Get stdout returning a standard handle.
  If the i/o error is not blank, exit.
  Call "kernel32.dll" "WriteFile" with the standard handle
    and the buffer's first and the buffer's length
    and a number's whereabouts and 0 returning the number.
  Call "kernel32.dll" "CloseHandle" with the standard handle.
  If the number is not 0, exit.
  Put "Error writing to the standard error stream." into the i/o error.

To get stdout returning a standard handle:
  \ std_input_handle = -10; std_output_handle = -11
  Call "kernel32.dll" "GetStdHandle"
    with -11 [std_output_handle]
    returning the standard handle.
  If the standard handle is -1 [invalid_handle_value],
    put "Error opening the standard output stream." into the i/o error; exit.

The Plain English IDE is available at github.com/Folds/english. The IDE runs on Windows. It compiles to 32-bit x86 code.

Write a buffer to stdout and Get stdout returning a standard handle seem like good candidates for adding to Plain English's library. Similar routines already exist for stderr.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Seems like a very interesting language, but very verbose. Wow! \$\endgroup\$ – Neil A. Jun 28 '17 at 6:35
  • \$\begingroup\$ Is there a character I am missing? It shows up as 307/899 bytes for me, respectively \$\endgroup\$ – Neil A. Jun 28 '17 at 6:37
  • \$\begingroup\$ @NeilA. - Your counts are probably correct. I estimated the byte counts by adding up the (1-based) indexes of the character positions after the last character on each line. It is likely that this process resulted in an extra character being counted after the last line. This process also assumes that the lines can be separated using one byte (such as a space or line feed) instead of the actual two-byte CRLF that is used when the editor saves the file. But since Plain English is designed to successfully compile the file if the CRLFs were replaced by spaces, the latter issue is not a problem. \$\endgroup\$ – Jasper Jun 28 '17 at 15:45
  • \$\begingroup\$ @NeilA. -- My first stab at the problem was much shorter (about 76 bytes), but it launched a complete CGI environment and output to that environment's stdout. This version outputs in the stdout that the user starts in. If I make Plain English treat stdout as nicely as it treats stderr, this version can be shortened to about 88 bytes. \$\endgroup\$ – Jasper Jun 28 '17 at 15:55
  • \$\begingroup\$ @programmer5000 -- According to the rules of this challenge, "The program must not write anything to STDERR." \$\endgroup\$ – Jasper Jul 19 '17 at 15:28
4
\$\begingroup\$

naz, 64 bytes

9a8m1o3d4m5a1o7a2o3a1o3d7a1o9s3s1o3m9s1o9a9a6a1o3a1o6s1o8s1o3d1o

naz is my new language where every command is given by a number and a letter. Programs operate on a single register whose value can be between -127 and 127, inclusive.

This program uses the instructions for add, subtract, multiply, and divide to set the register to the ASCII value of each character in the string Hello, World!, then outputs that character with the o instruction. In the case of the Ls in Hello, once the register is set to the correct value, 2o is used to output twice instead of just once.

| improve this answer | |
\$\endgroup\$
  • 3
    \$\begingroup\$ Welcome to the site :) \$\endgroup\$ – FlipTack Jan 1 at 11:57
4
\$\begingroup\$

Cood, 378 bytes

I want 72 of this
Im very hungry
More 29 of this
Im very hungry
More 7 of this
Im very hungry
Im very hungry
More 3 of this
Im very hungry
Less 67 of this
Im very hungry
Less 12 of this
Im very hungry
More 55 of this
Im very hungry
More 24 of this
Im very hungry
More 3 of this
Im very hungry
Less 6 of this
Im very hungry
Less 8 of this
Im very hungry
Less 67 of this
Im hungry

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 378 bytes: Try it online! \$\endgroup\$ – the default. Apr 11 at 9:47
  • \$\begingroup\$ I do not even use the TIO front page most of the time: I simply type in something like tio.run/#cood \$\endgroup\$ – the default. Apr 11 at 10:47
  • \$\begingroup\$ Ahh, I see. I don't know why it doesn't appear on the front page though. \$\endgroup\$ – user92069 Apr 11 at 10:48
  • \$\begingroup\$ It appears for me when I type Cood in the search bar. \$\endgroup\$ – the default. Apr 11 at 10:52
4
\$\begingroup\$

International Phonetic Esoteric Language, 16 bytes

"Hello, World!"o
"Hello, World!"  (push "Hello, World!")
               o (pop and print)
| improve this answer | |
\$\endgroup\$
1
6 7
8
9 10
27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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